I'm new in parsing and XML and using nodejs, I have try node-soap, easysoap, strong-soap, but I can't make neither that library work
this is my xml if I open the link the browser
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:myserv" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:myserv">
<types>
<xsd:schema targetNamespace="urn:myserv">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>
<xsd:complexType name="reqSearch">
<xsd:sequence>
<xsd:element name="Username" type="xsd:string" minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="respSearch">...</xsd:complexType>
</xsd:schema>
</types>
<message name="SearchRequest">
<part name="param" type="tns:reqSearch"/>
</message>
<message name="SearchResponse">
<part name="return" type="tns:respSearch"/>
</message>
<portType name="searchPortType">
<operation name="Search">
<documentation>Search Service</documentation>
<input message="tns:SearchRequest"/>
<output message="tns:SearchResponse"/>
</operation>
</portType>
<binding name="searchBinding" type="tns:searchPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Search">
<soap:operation soapAction="urn:s-service#Search" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:s-service" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:s-service" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="myserv">
<port name="searchPort" binding="tns:searchBinding">...</port>
</service>
</definitions>
What I try till now is like this
var clientParams = {
host : 'https://xxxxxxxxxxxxx',
path : '/xxxxx/xxxx.php',
wsdl : '/xxxxxxx/xxxx.php?wsdl'
};
var clientOptions = {
secure : false
};
var soapClient = easysoap.createClient(clientParams, clientOptions);
soapClient.call({
method : "Search",
})
.then((callResponse) => {
console.log(callResponse.data); // response data as json
console.log(callResponse.body); // response body
console.log(callResponse.header); //response header
})
.catch((err) => { throw new Error(err); });
soapClient.call({'method' : 'reqSearch',
'params' : {
'Username' : 'test',
}})
.then(function (callResponse) {
console.log(callResponse);
})
.catch(function (err) {
console.log("Got an error making SOAP call: ", err);
});
but there is no result. I think what I code is wrong. Please guide me how to parsing XML and get the result of respSearch
via Dirus
No comments:
Post a Comment