如何开始使用节点肥皂

Eakkapat Pattarathamrong

我尝试使用node-soap使用node.js制作soap-server。我有wsdl喜欢

<definitions name="HelloService"
   targetNamespace="http://www.examples.com/wsdl/HelloService.wsdl"
   xmlns="http://schemas.xmlsoap.org/wsdl/"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:tns="http://www.examples.com/wsdl/HelloService.wsdl"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema">

   <message name="SayHelloRequest">
    <part name="firstName" type="xsd:string"/>
   </message>
   <message name="SayHelloResponse">
    <part name="greeting" type="xsd:string"/>
   </message>

   <portType name="Hello_PortType">
    <operation name="sayHello">
       <input message="tns:SayHelloRequest"/>
       <output message="tns:SayHelloResponse"/>
    </operation>
   </portType>

   <binding name="Hello_Binding" type="tns:Hello_PortType">
   <soap:binding style="rpc"
    transport="http://schemas.xmlsoap.org/soap/http"/>
   <operation name="sayHello">
    <soap:operation soapAction="sayHello"/>
    <input>
       <soap:body
        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        namespace="urn:examples:helloservice"
        use="encoded"/>
    </input>
    <output>
       <soap:body
        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        namespace="urn:examples:helloservice"
        use="encoded"/>
    </output>
   </operation>
   </binding>

   <service name="Hello_Service">
    <documentation>WSDL File for HelloService</documentation>
    <port binding="tns:Hello_Binding" name="Hello_Port">
       <soap:address
        location="http://localhost:8000/wsdl">
    </port>
   </service>
</definitions>

和我的代码

var http = require('http');
var soap = require('soap');
var helloService = {
  Hello_Service: {
    Hello_Port: {
      SayHelloRequest: function(args) {
        return {
          firstName: args.name
        };
      }
    }
  }
}
var xml = require('fs').readFileSync('HelloService.wsdl', 'utf8'),
      server = http.createServer(function(request,response) {
          response.end("404: Not Found: "+request.url)
      });
server.listen(8000);
soap.listen(server, '/wsdl', helloService, xml);

我把它们放在同一个目录但是出错

/nodejs_ws_demo/node_modules/soap/lib/wsdl.js:937抛出新错误(p.getError()); ^错误:标签不匹配

我如何解决它。

维纳尔

wsdl文件中有错误。肥皂标签未关闭。

<soap:address
        location="http://localhost:8000/wsdl"/>

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章