toy3536
钻石会员
钻石会员
  • 发帖数64
  • QQ37987572
  • 金币981两
  • 威望439点
  • 钻石0枚
  • 注册日期2016-11-10
  • 最后登录2023-06-14
  • 社区居民
  • 忠实会员
阅读:11789回复:3

[问题求助]有人能提供一个webservie 通过POST 传值给别的服务器调用吗?

楼主#
更多 发布于:2018-08-03 18:28
如题,webservice 现在要用POST的方式传数据给别的系统, 不知道怎么写的。求助,最好能给个简单例子。谢谢!
喜欢1 评分0

最新喜欢:

szlongszlong
toy3536
钻石会员
钻石会员
  • 发帖数64
  • QQ37987572
  • 金币981两
  • 威望439点
  • 钻石0枚
  • 注册日期2016-11-10
  • 最后登录2023-06-14
  • 社区居民
  • 忠实会员
沙发#
发布于:2018-08-06 14:44
Perry:如果对方是SOAP,直接
fglwsdl http://X.X.X.X:8080/datahubWeb/WMSSOAP/FLUXWMSSOAP然后调用产生的4gl里的方法,把xml字符串传递过去就可以了
回到原帖
现在,他们这种只能用POST方式传递,不能用方法传参。这个写法都是参考你查快递信息做的。现在报这个错误,无从下手了。能协助下吗?
回复(0) 喜欢(0)     评分
Perry
管理员
管理员
  • 发帖数213
  • QQ396572376
  • 金币43124两
  • 威望11389点
  • 钻石8888枚
  • 注册日期2016-11-09
  • 最后登录2024-10-16
  • VIP会员
  • 荣誉会员
  • 优秀斑竹
  • 最爱沙发
  • 原创写手
  • 社区居民
板凳#
发布于:2018-08-06 14:29
如果对方是SOAP,直接
fglwsdl http://X.X.X.X:8080/datahubWeb/WMSSOAP/FLUXWMSSOAP
然后调用产生的4gl里的方法,把xml字符串传递过去就可以了
官方QQ群:556775727  
回复(1) 喜欢(0)     评分
toy3536
钻石会员
钻石会员
  • 发帖数64
  • QQ37987572
  • 金币981两
  • 威望439点
  • 钻石0枚
  • 注册日期2016-11-10
  • 最后登录2023-06-14
  • 社区居民
  • 忠实会员
地板#
发布于: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>"
回复(0) 喜欢(0)     评分
游客

返回顶部