如题,webservice 现在要用POST的方式传数据给别的系统, 不知道怎么写的。求助,最好能给个简单例子。谢谢!
|
|
最新喜欢:szlong |
沙发#
发布于:2018-08-06 14:02
LET ReqURL = "http://X.X.X.X:8080/datahubWeb/WMSSOAP/FLUXWMSSOAP" LET requestData="<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ws='http://ws.webservices.services.adapter.datahub/'><soapenv:Header/><soapenv:Body><ws:putSKUData><wmsSecurityInfo><password>flux</password><username>flux</username></wmsSecurityInfo><skuInfo><wmsSkuHeaders><CUSTOMERID>BCP</CUSTOMERID><SKU>TMWJ150159</SKU><ACTIVE_FLAG>Y</ACTIVE_FLAG><DESCR_C>99021QCC90mm*85.00mm*295.24mm</DESCR_C><DESCR_E></DESCR_E><GROSSWEIGHT></GROSSWEIGHT><NETWEIGHT> 0.000</NETWEIGHT><CUBE> 0.000</CUBE><SKU_GROUP1>W-SLB</SKU_GROUP1><SKU_GROUP2>SLB</SKU_GROUP2><SKU_GROUP3>N</SKU_GROUP3><SKU_GROUP4>S01_成品</SKU_GROUP4><SKU_GROUP5></SKU_GROUP5><SKU_GROUP6></SKU_GROUP6><SKU_GROUP9>M</SKU_GROUP9><RESERVEDFIELD01>PCS_个</RESERVEDFIELD01><RESERVEDFIELD02>PCS_个</RESERVEDFIELD02><RESERVEDFIELD03>PCS_个</RESERVEDFIELD03><RESERVEDFIELD04>PCS_个</RESERVEDFIELD04><RESERVEDFIELD05></RESERVEDFIELD05><RESERVEDFIELD06>DKBA8.007.0703</RESERVEDFIELD06><RESERVEDFIELD07>F</RESERVEDFIELD07><RESERVEDFIELD08></RESERVEDFIELD08><RESERVEDFIELD09></RESERVEDFIELD09><RESERVEDFIELD10></RESERVEDFIELD10><RESERVEDFIELD11></RESERVEDFIELD11><RESERVEDFIELD12>Y</RESERVEDFIELD12><RESERVEDFIELD13> 0.000</RESERVEDFIELD13><RESERVEDFIELD14> 10.0000</RESERVEDFIELD14><NOTES></NOTES><INBOUNDLIFEDAYS> 150</INBOUNDLIFEDAYS><OVERRCVPERCENTAGE>0</OVERRCVPERCENTAGE><QTYMAX> 0.000</QTYMAX><QTYMIN> 0.000</QTYMIN><UPDATE_FLAG></UPDATE_FLAG><UPDATE_TIME>2018-08-03 00:00:00</UPDATE_TIME><UPDATE_WHO>140</UPDATE_WHO><MESSAGE_GROUP_SYSID></MESSAGE_GROUP_SYSID></wmsSkuHeaders></skuInfo><wmsParam><customerid>XXXX</customerid><messageid>SKU</messageid><param></param><stdno>SKU</stdno><warehouseid>WH01</warehouseid></wmsParam></ws:putSKUData></soapenv:Body></soapenv:Envelope>" LET requestData_url = java.net.URLEncoder.encode(requestData,"UTF-8") TRY LET req = com.HTTPRequest.Create(ReqURL) CALL req.setTimeOut(3000) CALL req.setMethod("POST") CALL req.doFormEncodedRequest(requestData_url, TRUE) LET resp = req.getResponse() LET xmlstr = resp.getTextResponse() CATCH CALL cl_err("","ERROR :"||STATUS||" ("||SQLCA.SQLERRM||")",1) END TRY 以上代码执行后总是 报 以下错误,有人知道写法哪里有问题吗? xmlstr = "<!doctype html><html lang="en"><head><title>HTTP Status 500 – Internal Server Error</title><style type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}</style></head><body><h1>HTTP Status 500 – Internal Server Error</h1><hr class="line" /><p><b>Type</b> Exception Report</p><p><b>Message</b> JAXM POST failed Invalid Content-Type:application/x-www-form-urlencoded. Is this an error message instead of a SOAP response?</p><p><b>Description</b> The server encountered an unexpected condition that prevented it from fulfilling the request.</p><p><b>Exception</b> <pre>javax.servlet.ServletException: JAXM POST failed Invalid Content-Type:application/x-www-form-urlencoded. Is this an error message instead of a SOAP response?\n\tdatahub.adapter.services.webservices.ws.DatahubJAXMServlet.doPost(DatahubJAXMServlet.java:297)\n\tjavax.servlet.http.HttpServlet.service(HttpServlet.java:650)\n\tjavax.servlet.http.HttpServlet.service(HttpServlet.java:731)\n\torg.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)\n</pre></p><p><b>Note</b> The full stack trace of the root cause is available in the server logs.</p><hr class="line" /><h3>Apache Tomcat/7.0.90</h3></body></html>" |
|
板凳#
发布于:2018-08-06 14:29
如果对方是SOAP,直接
fglwsdl http://X.X.X.X:8080/datahubWeb/WMSSOAP/FLUXWMSSOAP然后调用产生的4gl里的方法,把xml字符串传递过去就可以了 |
|
地板#
发布于:2018-08-06 14:44
Perry:如果对方是SOAP,直接现在,他们这种只能用POST方式传递,不能用方法传参。这个写法都是参考你查快递信息做的。现在报这个错误,无从下手了。能协助下吗? |
|