我收到了一位客户关于其 Web 服务客户端如何工作的规范。该规范是从服务发送和接收的实际 SOAP XML 消息以及相应的 XSD。客户希望我实现一个符合客户要求的网络服务。客户端是用 axis2 ws-stack 编写的,我想做的是在 WCF 中创建一个 Web 服务,它将接受客户端发出的请求并返回符合他们期望的 XML 的响应。在这个问题中,我将只发布与请求相关的 XML 和 XSD,因为如果我能让它工作,响应将以类似的方式做出。
我收到的 XML 如下:
POST /axis2/services/SampleService HTTP/1.1
Content-Type: text/xml; charset=UTF-8
SOAPAction: "sendCommand"
User-Agent: Axis2
Host: 127.0.0.1:7777
Content-Length: 347
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SendCommandRequest xmlns="http://something.org/">
<CMD>
<Station Address="ABC">
<Platform Address="DEF">
<Command>5</Command>
</Platform>
</Station>
</CMD>
</SendCommandRequest>
</soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)
相应的 XSD 如下所示:
<xsd:complexType name="SendCommandRequestType">
<xsd:sequence>
<xsd:element name="Station">
<xsd:complexType>
<xsd:attribute name="Address" type="xsd:string" use="required" />
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="Platform">
<xsd:complexType>
<xsd:attribute name="Address" type="xsd:string" use="required" …Run Code Online (Sandbox Code Playgroud)