现在我们想通过接收联通发送给我们的sp订购通知包写入xml,然后解析处理,并且返回给联通一个response包。现在不清楚这个resonse包应该是怎样的格式?
不知有做过联通vac sp订购关系处理的吗?麻烦给指点一下或者提供以下response的xml包格式,谢谢! 我邮箱是: hongjun1178@gmail.com
现在联通就给我们一个VacSyncService_SPClient.wsdl文件,
以下是wsdl源码:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:tns3="http://rsp.sync.soap.bossagent.vac.unicom.com" xmlns:impl="http://soap.bossagent.vac.unicom.com" xmlns:intf="http://soap.bossagent.vac.unicom.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns2="http://req.sync.soap.bossagent.vac.unicom.com" xmlns:tns4="http://type.sync.soap.bossagent.vac.unicom.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://soap.bossagent.vac.unicom.com">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://req.sync.soap.bossagent.vac.unicom.com">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="OrderRelationUpdateNotifyRequest">
<sequence>
<element name="recordSequenceId" nillable="true" type="soapenc:string"/>
<element name="userIdType" nillable="true" type="soapenc:int"/>
<element name="userId" nillable="true" type="soapenc:string"/>
<element name="serviceType" nillable="true" type="soapenc:string"/>
<element name="spId" nillable="true" type="soapenc:string"/>
<element name="productId" nillable="true" type="soapenc:string"/>
<element name="updateType" nillable="true" type="soapenc:int"/>
<element name="updateTime" nillable="true" type="soapenc:string"/>
<element name="updateDesc" nillable="true" type="soapenc:string"/>
<element name="linkId" nillable="true" type="soapenc:string"/>
<element name="content" nillable="true" type="soapenc:string"/>
<element name="effectiveDate" nillable="true" type="soapenc:string"/>
<element name="expireDate" nillable="true" type="soapenc:string"/>
<element name="time_stamp" nillable="true" type="soapenc:string"/>
<element name="encodeStr" nillable="true" type="soapenc:string"/>
</sequence>
</complexType>
</schema>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://rsp.sync.soap.bossagent.vac.unicom.com">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="OrderRelationUpdateNotifyResponse">
<sequence>
<element name="recordSequenceId" nillable="true" type="soapenc:string"/>
<element name="resultCode" type="xsd:int"/>
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="orderRelationUpdateNotifyRequest">
<wsdl:part name="orderRelationUpdateNotifyRequest" type="tns2:OrderRelationUpdateNotifyRequest"/>
</wsdl:message>
<wsdl:message name="orderRelationUpdateNotifyResponse">
<wsdl:part name="orderRelationUpdateNotifyReturn" type="tns3:OrderRelationUpdateNotifyResponse"/>
</wsdl:message>
<wsdl:portType name="SyncNotifySPService">
<wsdl:operation name="orderRelationUpdateNotify" parameterOrder="orderRelationUpdateNotifyRequest">
<wsdl:input name="orderRelationUpdateNotifyRequest" message="impl:orderRelationUpdateNotifyRequest"/>
<wsdl:output name="orderRelationUpdateNotifyResponse" message="impl:orderRelationUpdateNotifyResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SyncNotifySPSoapBinding" type="impl:SyncNotifySPService">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="orderRelationUpdateNotify">
<wsdlsoap:operation/>
<wsdl:input>
<wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://soap.bossagent.vac.unicom.com"/>
</wsdl:input>
<wsdl:output>
<wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://soap.bossagent.vac.unicom.com"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SyncNotifySPServiceService">
<wsdl:port name="SyncNotifySP" binding="impl:SyncNotifySPSoapBinding">
<wsdlsoap:address location="http://localhost/services/VacSync"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
10 个解决方案
#1
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:m0="http://req.sync.soap.bossagent.vac.unicom.com" xmlns:m1="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<m:orderRelationUpdateNotify xmlns:m="http://soap.bossagent.vac.unicom.com" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<orderRelationUpdateNotifyRequest xsi:type="m0:OrderRelationUpdateNotifyRequest">
<recordSequenceId xsi:type="m1:string" id="" href=""/>
<userIdType xsi:type="m1:int" id="" href=""/>
<userId xsi:type="m1:string" id="" href=""/>
<serviceType xsi:type="m1:string" id="" href=""/>
<spId xsi:type="m1:string" id="" href=""/>
<productId xsi:type="m1:string" id="" href=""/>
<updateType xsi:type="m1:int" id="" href=""/>
<updateTime xsi:type="m1:string" id="" href=""/>
<updateDesc xsi:type="m1:string" id="" href=""/>
<linkId xsi:type="m1:string" id="" href=""/>
<content xsi:type="m1:string" id="" href=""/>
<effectiveDate xsi:type="m1:string" id="" href=""/>
<expireDate xsi:type="m1:string" id="" href=""/>
<time_stamp xsi:type="m1:string" id="" href=""/>
<encodeStr xsi:type="m1:string" id="" href=""/>
</orderRelationUpdateNotifyRequest>
</m:orderRelationUpdateNotify>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
#2
楼上的不是我们response给联通的的xml包,并且我这边接收的xml包跟您写的也不一样:
以上是我收到联通发送给我们的resquest包,我接收写入xml的
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body><ns1:orderRelationUpdateNotify soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://soap.bossagent.vac.unicom.com">
<orderRelationUpdateNotifyRequest href="#id0"/>
</ns1:orderRelationUpdateNotify>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:OrderRelationUpdateNotifyRequest" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://req.sync.soap.bossagent.vac.unicom.com">
<recordSequenceId xsi:type="soapenc:string">200908161759250750</recordSequenceId>
<userIdType href="#id1"/>
<userId xsi:type="soapenc:string">861321111111111</userId>
<serviceType xsi:type="soapenc:string">90</serviceType>
<spId xsi:type="soapenc:string">43390</spId>
<productId xsi:type="soapenc:string">9017011901</productId>
<updateType href="#id2"/>
<updateTime xsi:type="soapenc:string">20090816175925</updateTime>
<updateDesc xsi:type="soapenc:string">
</updateDesc><linkId xsi:type="soapenc:string">
</linkId><content xsi:type="soapenc:string">Y</content>
<effectiveDate xsi:type="soapenc:string">20090801000000</effectiveDate>
<expireDate xsi:type="soapenc:string">21001231000000</expireDate>
<time_stamp xsi:type="soapenc:string">0816175925</time_stamp>
<encodeStr xsi:type="soapenc:string">
</encodeStr>
</multiRef>
<multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1</multiRef>
<multiRef id="id2" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1</multiRef>
</soapenv:Body>
</soapenv:Envelope>
以上是我收到联通发送给我们的resquest包,我接收写入xml的
#3
你可以直接用xmlspy之类的工具测试的,不需要写代码。
#4
我在用这个Altova XMLSpy测试,不过没怎么用过,获取的xml是单个方法的,我从网上看好像也是可以的,不过我还没弄出来.....
#5
还没解决,XMLSpy用的非常熟的吗?我测试简单的webservice是没问题的,可是联通的这个wsdl文件不是很规范,现在测试提示“ HTTP错误,不能post文件‘vac/services/SyncNotifySPService?wsdl’在服务器'localhost'上(500)”
有知道这个错误的吗,麻烦指点一下,谢谢!
有知道这个错误的吗,麻烦指点一下,谢谢!
#6
的确它的WSDL定义不是规范的,RPC-Encoded的方式不符合WS-I的规范。即在异构系统进行交互的时候可能会有问题。譬如一个为java平台,一个为.net平台的。
出现 不能post文件 。。。。的错误是应为xmlspy自动生成的soap请求有bug,必须手动的把
id="" href="" 这些去掉
即 <userIdType xsi:type="m1:int" id="" href=""/> ---> <userIdType xsi:type="m1:int"/>
出现 不能post文件 。。。。的错误是应为xmlspy自动生成的soap请求有bug,必须手动的把
id="" href="" 这些去掉
即 <userIdType xsi:type="m1:int" id="" href=""/> ---> <userIdType xsi:type="m1:int"/>
#7
还是提示之前的错误,我测我写的webservice是可以有返回的都是正常的。
我写的是获取2个数相加的结果的webservice
在xmlspy里面
请求内容是:
返回response内容是:
我写的是获取2个数相加的结果的webservice
在xmlspy里面
请求内容是:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<m:getResult xmlns:m="http://test.webservice.com" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<a xsi:type="xsd:int">1</a>
<b xsi:type="xsd:int">2</b>
</m:getResult>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
返回response内容是:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:getResultResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://test.webservice.com">
<getResultReturn xsi:type="xsd:int">3</getResultReturn>
</ns1:getResultResponse>
</soapenv:Body>
</soapenv:Envelope>
#8
以下是我通过抓包获取的request包和response包,大家可以测试下,不过我目前还没测好,希望大家多提意见,我现在在用java—+axis1.4实现,还在测试中。。。。。。。。。。。。
有实现的朋友麻烦给支持一下,或者将标准的返回包传我一份,hongjun1178@gmail.com谢谢!
有实现的朋友麻烦给支持一下,或者将标准的返回包传我一份,hongjun1178@gmail.com谢谢!
Host: 218.57.19.98:8080
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 1729
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:orderRelationUpdateNotify soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://soap.bossagent.vac.unicom.com">
<orderRelationUpdateNotifyRequest href="#id0"/>
</ns1:orderRelationUpdateNotify>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:OrderRelationUpdateNotifyRequest"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="http://req.sync.soap.bossagent.vac.unicom.com">
<recordSequenceId xsi:type="soapenc:string">200908111125185691</recordSequenceId>
<userIdType href="#id1"/>
<userId xsi:type="soapenc:string">137222125062</userId>
<serviceType xsi:type="soapenc:string">22223</serviceType>
<spId xsi:type="soapenc:string">41690</spId>
<productId xsi:type="soapenc:string">9000122</productId><updateType href="#id1"/><updateTime xsi:type="soapenc:string" xsi:nil="true"/><updateDesc xsi:type="soapenc:string" xsi:nil="true"/><linkId xsi:type="soapenc:string" xsi:nil="true"/><content xsi:type="soapenc:string" xsi:nil="true"/><effectiveDate xsi:type="soapenc:string" xsi:nil="true"/><expireDate xsi:type="soapenc:string" xsi:nil="true"/><time_stamp xsi:type="soapenc:string" xsi:nil="true"/><encodeStr xsi:type="soapenc:string" xsi:nil="true"/></multiRef><multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1</multiRef></soapenv:Body></soapenv:Envelope>
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Date: Fri, 21 Aug 2009 07:12:52 GMT
Connection: close
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:orderRelationUpdateNotifyResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://soap.bossagent.vac.unicom.com">
<orderRelationUpdateNotifyReturn href="#id0"/>
</ns1:orderRelationUpdateNotifyResponse>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:OrderRelationUpdateNotifyResponse"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="http://rsp.sync.soap.bossagent.vac.unicom.com">
<recordSequenceId xsi:type="soapenc:string">200908111125185691</recordSequenceId>
<resultCode href="#id1"/>
</multiRef>
<multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef>
</soapenv:Body>
</soapenv:Envelope>
#9
还有有朋友测试通过或者讨论问题可以加我QQ:380386614(注名为 联通vac订购关系),谢谢!
#10
我做个彩信的VAC,就是接收到VAC发送过来的包,处理后发回一个包给他就完了
这是返回包的函数 C#的
private string Response(string RecordSequenceID, string ResultCode)
{
StringListBuilder slb = new StringListBuilder();
slb.Append("HTTP/1.1 200 OK");
slb.Append("Server: Apache-Coyote/1.1");
slb.Append("Content-Type: text/xml;charset=utf-8");
slb.Append("Date:" + DateTime.Now.GetDateTimeFormats('r')[0].ToString());
slb.Append("Connection: close");
slb.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
slb.Append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"");
slb.Append("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">");
slb.Append("<soapenv:Body>");
slb.Append("<ns1:orderRelationUpdateNotifyResponse soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"");
slb.Append("xmlns:ns1=\"http://soap.bossagent.vac.unicom.com\">");
slb.Append(" <orderRelationUpdateNotifyReturn href=\"#id0\"/>");
slb.Append("</ns1:orderRelationUpdateNotifyResponse>");
slb.Append("<multiRef id=\"id0\" soapenc:root=\"0\" soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"");
slb.Append("xsi:type=\"ns2:OrderRelationUpdateNotifyResponse\"");
slb.Append("xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"");
slb.Append("xmlns:ns2=\"http://rsp.sync.soap.bossagent.vac.unicom.com\">");
slb.Append("<recordSequenceId xsi:type=\"soapenc:string\">" + RecordSequenceID + "</recordSequenceId>");
slb.Append("<resultCode href=\"#id1\"/>");
slb.Append("</multiRef>");
slb.Append("<multiRef id=\"id1\" soapenc:root=\"0\" soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xsi:type=\"xsd:int\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"+ResultCode+"</multiRef>");
slb.Append("</soapenv:Body>");
slb.Append("</soapenv:Envelope>");
return slb.ToString();
}
这是返回包的函数 C#的
private string Response(string RecordSequenceID, string ResultCode)
{
StringListBuilder slb = new StringListBuilder();
slb.Append("HTTP/1.1 200 OK");
slb.Append("Server: Apache-Coyote/1.1");
slb.Append("Content-Type: text/xml;charset=utf-8");
slb.Append("Date:" + DateTime.Now.GetDateTimeFormats('r')[0].ToString());
slb.Append("Connection: close");
slb.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
slb.Append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"");
slb.Append("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">");
slb.Append("<soapenv:Body>");
slb.Append("<ns1:orderRelationUpdateNotifyResponse soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"");
slb.Append("xmlns:ns1=\"http://soap.bossagent.vac.unicom.com\">");
slb.Append(" <orderRelationUpdateNotifyReturn href=\"#id0\"/>");
slb.Append("</ns1:orderRelationUpdateNotifyResponse>");
slb.Append("<multiRef id=\"id0\" soapenc:root=\"0\" soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"");
slb.Append("xsi:type=\"ns2:OrderRelationUpdateNotifyResponse\"");
slb.Append("xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"");
slb.Append("xmlns:ns2=\"http://rsp.sync.soap.bossagent.vac.unicom.com\">");
slb.Append("<recordSequenceId xsi:type=\"soapenc:string\">" + RecordSequenceID + "</recordSequenceId>");
slb.Append("<resultCode href=\"#id1\"/>");
slb.Append("</multiRef>");
slb.Append("<multiRef id=\"id1\" soapenc:root=\"0\" soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xsi:type=\"xsd:int\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"+ResultCode+"</multiRef>");
slb.Append("</soapenv:Body>");
slb.Append("</soapenv:Envelope>");
return slb.ToString();
}
#1
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:m0="http://req.sync.soap.bossagent.vac.unicom.com" xmlns:m1="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<m:orderRelationUpdateNotify xmlns:m="http://soap.bossagent.vac.unicom.com" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<orderRelationUpdateNotifyRequest xsi:type="m0:OrderRelationUpdateNotifyRequest">
<recordSequenceId xsi:type="m1:string" id="" href=""/>
<userIdType xsi:type="m1:int" id="" href=""/>
<userId xsi:type="m1:string" id="" href=""/>
<serviceType xsi:type="m1:string" id="" href=""/>
<spId xsi:type="m1:string" id="" href=""/>
<productId xsi:type="m1:string" id="" href=""/>
<updateType xsi:type="m1:int" id="" href=""/>
<updateTime xsi:type="m1:string" id="" href=""/>
<updateDesc xsi:type="m1:string" id="" href=""/>
<linkId xsi:type="m1:string" id="" href=""/>
<content xsi:type="m1:string" id="" href=""/>
<effectiveDate xsi:type="m1:string" id="" href=""/>
<expireDate xsi:type="m1:string" id="" href=""/>
<time_stamp xsi:type="m1:string" id="" href=""/>
<encodeStr xsi:type="m1:string" id="" href=""/>
</orderRelationUpdateNotifyRequest>
</m:orderRelationUpdateNotify>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
#2
楼上的不是我们response给联通的的xml包,并且我这边接收的xml包跟您写的也不一样:
以上是我收到联通发送给我们的resquest包,我接收写入xml的
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body><ns1:orderRelationUpdateNotify soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://soap.bossagent.vac.unicom.com">
<orderRelationUpdateNotifyRequest href="#id0"/>
</ns1:orderRelationUpdateNotify>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:OrderRelationUpdateNotifyRequest" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://req.sync.soap.bossagent.vac.unicom.com">
<recordSequenceId xsi:type="soapenc:string">200908161759250750</recordSequenceId>
<userIdType href="#id1"/>
<userId xsi:type="soapenc:string">861321111111111</userId>
<serviceType xsi:type="soapenc:string">90</serviceType>
<spId xsi:type="soapenc:string">43390</spId>
<productId xsi:type="soapenc:string">9017011901</productId>
<updateType href="#id2"/>
<updateTime xsi:type="soapenc:string">20090816175925</updateTime>
<updateDesc xsi:type="soapenc:string">
</updateDesc><linkId xsi:type="soapenc:string">
</linkId><content xsi:type="soapenc:string">Y</content>
<effectiveDate xsi:type="soapenc:string">20090801000000</effectiveDate>
<expireDate xsi:type="soapenc:string">21001231000000</expireDate>
<time_stamp xsi:type="soapenc:string">0816175925</time_stamp>
<encodeStr xsi:type="soapenc:string">
</encodeStr>
</multiRef>
<multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1</multiRef>
<multiRef id="id2" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1</multiRef>
</soapenv:Body>
</soapenv:Envelope>
以上是我收到联通发送给我们的resquest包,我接收写入xml的
#3
你可以直接用xmlspy之类的工具测试的,不需要写代码。
#4
我在用这个Altova XMLSpy测试,不过没怎么用过,获取的xml是单个方法的,我从网上看好像也是可以的,不过我还没弄出来.....
#5
还没解决,XMLSpy用的非常熟的吗?我测试简单的webservice是没问题的,可是联通的这个wsdl文件不是很规范,现在测试提示“ HTTP错误,不能post文件‘vac/services/SyncNotifySPService?wsdl’在服务器'localhost'上(500)”
有知道这个错误的吗,麻烦指点一下,谢谢!
有知道这个错误的吗,麻烦指点一下,谢谢!
#6
的确它的WSDL定义不是规范的,RPC-Encoded的方式不符合WS-I的规范。即在异构系统进行交互的时候可能会有问题。譬如一个为java平台,一个为.net平台的。
出现 不能post文件 。。。。的错误是应为xmlspy自动生成的soap请求有bug,必须手动的把
id="" href="" 这些去掉
即 <userIdType xsi:type="m1:int" id="" href=""/> ---> <userIdType xsi:type="m1:int"/>
出现 不能post文件 。。。。的错误是应为xmlspy自动生成的soap请求有bug,必须手动的把
id="" href="" 这些去掉
即 <userIdType xsi:type="m1:int" id="" href=""/> ---> <userIdType xsi:type="m1:int"/>
#7
还是提示之前的错误,我测我写的webservice是可以有返回的都是正常的。
我写的是获取2个数相加的结果的webservice
在xmlspy里面
请求内容是:
返回response内容是:
我写的是获取2个数相加的结果的webservice
在xmlspy里面
请求内容是:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<m:getResult xmlns:m="http://test.webservice.com" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<a xsi:type="xsd:int">1</a>
<b xsi:type="xsd:int">2</b>
</m:getResult>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
返回response内容是:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:getResultResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://test.webservice.com">
<getResultReturn xsi:type="xsd:int">3</getResultReturn>
</ns1:getResultResponse>
</soapenv:Body>
</soapenv:Envelope>
#8
以下是我通过抓包获取的request包和response包,大家可以测试下,不过我目前还没测好,希望大家多提意见,我现在在用java—+axis1.4实现,还在测试中。。。。。。。。。。。。
有实现的朋友麻烦给支持一下,或者将标准的返回包传我一份,hongjun1178@gmail.com谢谢!
有实现的朋友麻烦给支持一下,或者将标准的返回包传我一份,hongjun1178@gmail.com谢谢!
Host: 218.57.19.98:8080
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 1729
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:orderRelationUpdateNotify soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://soap.bossagent.vac.unicom.com">
<orderRelationUpdateNotifyRequest href="#id0"/>
</ns1:orderRelationUpdateNotify>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:OrderRelationUpdateNotifyRequest"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="http://req.sync.soap.bossagent.vac.unicom.com">
<recordSequenceId xsi:type="soapenc:string">200908111125185691</recordSequenceId>
<userIdType href="#id1"/>
<userId xsi:type="soapenc:string">137222125062</userId>
<serviceType xsi:type="soapenc:string">22223</serviceType>
<spId xsi:type="soapenc:string">41690</spId>
<productId xsi:type="soapenc:string">9000122</productId><updateType href="#id1"/><updateTime xsi:type="soapenc:string" xsi:nil="true"/><updateDesc xsi:type="soapenc:string" xsi:nil="true"/><linkId xsi:type="soapenc:string" xsi:nil="true"/><content xsi:type="soapenc:string" xsi:nil="true"/><effectiveDate xsi:type="soapenc:string" xsi:nil="true"/><expireDate xsi:type="soapenc:string" xsi:nil="true"/><time_stamp xsi:type="soapenc:string" xsi:nil="true"/><encodeStr xsi:type="soapenc:string" xsi:nil="true"/></multiRef><multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1</multiRef></soapenv:Body></soapenv:Envelope>
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Date: Fri, 21 Aug 2009 07:12:52 GMT
Connection: close
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:orderRelationUpdateNotifyResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://soap.bossagent.vac.unicom.com">
<orderRelationUpdateNotifyReturn href="#id0"/>
</ns1:orderRelationUpdateNotifyResponse>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:OrderRelationUpdateNotifyResponse"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="http://rsp.sync.soap.bossagent.vac.unicom.com">
<recordSequenceId xsi:type="soapenc:string">200908111125185691</recordSequenceId>
<resultCode href="#id1"/>
</multiRef>
<multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef>
</soapenv:Body>
</soapenv:Envelope>
#9
还有有朋友测试通过或者讨论问题可以加我QQ:380386614(注名为 联通vac订购关系),谢谢!
#10
我做个彩信的VAC,就是接收到VAC发送过来的包,处理后发回一个包给他就完了
这是返回包的函数 C#的
private string Response(string RecordSequenceID, string ResultCode)
{
StringListBuilder slb = new StringListBuilder();
slb.Append("HTTP/1.1 200 OK");
slb.Append("Server: Apache-Coyote/1.1");
slb.Append("Content-Type: text/xml;charset=utf-8");
slb.Append("Date:" + DateTime.Now.GetDateTimeFormats('r')[0].ToString());
slb.Append("Connection: close");
slb.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
slb.Append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"");
slb.Append("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">");
slb.Append("<soapenv:Body>");
slb.Append("<ns1:orderRelationUpdateNotifyResponse soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"");
slb.Append("xmlns:ns1=\"http://soap.bossagent.vac.unicom.com\">");
slb.Append(" <orderRelationUpdateNotifyReturn href=\"#id0\"/>");
slb.Append("</ns1:orderRelationUpdateNotifyResponse>");
slb.Append("<multiRef id=\"id0\" soapenc:root=\"0\" soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"");
slb.Append("xsi:type=\"ns2:OrderRelationUpdateNotifyResponse\"");
slb.Append("xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"");
slb.Append("xmlns:ns2=\"http://rsp.sync.soap.bossagent.vac.unicom.com\">");
slb.Append("<recordSequenceId xsi:type=\"soapenc:string\">" + RecordSequenceID + "</recordSequenceId>");
slb.Append("<resultCode href=\"#id1\"/>");
slb.Append("</multiRef>");
slb.Append("<multiRef id=\"id1\" soapenc:root=\"0\" soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xsi:type=\"xsd:int\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"+ResultCode+"</multiRef>");
slb.Append("</soapenv:Body>");
slb.Append("</soapenv:Envelope>");
return slb.ToString();
}
这是返回包的函数 C#的
private string Response(string RecordSequenceID, string ResultCode)
{
StringListBuilder slb = new StringListBuilder();
slb.Append("HTTP/1.1 200 OK");
slb.Append("Server: Apache-Coyote/1.1");
slb.Append("Content-Type: text/xml;charset=utf-8");
slb.Append("Date:" + DateTime.Now.GetDateTimeFormats('r')[0].ToString());
slb.Append("Connection: close");
slb.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
slb.Append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"");
slb.Append("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">");
slb.Append("<soapenv:Body>");
slb.Append("<ns1:orderRelationUpdateNotifyResponse soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"");
slb.Append("xmlns:ns1=\"http://soap.bossagent.vac.unicom.com\">");
slb.Append(" <orderRelationUpdateNotifyReturn href=\"#id0\"/>");
slb.Append("</ns1:orderRelationUpdateNotifyResponse>");
slb.Append("<multiRef id=\"id0\" soapenc:root=\"0\" soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"");
slb.Append("xsi:type=\"ns2:OrderRelationUpdateNotifyResponse\"");
slb.Append("xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"");
slb.Append("xmlns:ns2=\"http://rsp.sync.soap.bossagent.vac.unicom.com\">");
slb.Append("<recordSequenceId xsi:type=\"soapenc:string\">" + RecordSequenceID + "</recordSequenceId>");
slb.Append("<resultCode href=\"#id1\"/>");
slb.Append("</multiRef>");
slb.Append("<multiRef id=\"id1\" soapenc:root=\"0\" soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xsi:type=\"xsd:int\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"+ResultCode+"</multiRef>");
slb.Append("</soapenv:Body>");
slb.Append("</soapenv:Envelope>");
return slb.ToString();
}