Web Services Port {http://ttdev.com/ss}p1 not found - service

I am new to web services, I bought a book and started to learn from it, the WSDL is :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ttdev.com/ss" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="SimpleService" targetNamespace="http://ttdev.com/ss">
<wsdl:types>
<xsd:schema targetNamespace="http://ttdev.com/ss">
<xsd:element name="concatRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="s1" type="xsd:string" />
<xsd:element name="s2" type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="concatResponse" type="xsd:string">
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="concatRequest">
<wsdl:part element="tns:concatRequest" name="parameters"/>
</wsdl:message>
<wsdl:message name="concatResponse">
<wsdl:part element="tns:concatResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="SimpleService">
<wsdl:operation name="concat">
<wsdl:input message="tns:concatRequest"/>
<wsdl:output message="tns:concatResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SimpleServiceSOAP" type="tns:SimpleService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="concat">
<soap:operation soapAction="http://ttdev.com/ss/NewOperation"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SimpleService">
<wsdl:port binding="tns:SimpleServiceSOAP" name="p1">
<soap:address location="http://localhost:8080/ss/p1"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I run the SimpleService_P1_Server, it s working, but when I run the client :
SimpleService_P1_Client I got this exeption :
Apr 8, 2012 9:51:47 AM com.ttdev.ss.SimpleService_Service <clinit>
INFO: Can not initialize the default wsdl from src/main/resources/SimpleService.wsdl
Exception in thread "main" javax.xml.ws.WebServiceException: Port {http://ttdev.com/ss}p1 not found.
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:328)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:319)
at javax.xml.ws.Service.getPort(Unknown Source)
at com.ttdev.ss.SimpleService_Service.getP1(SimpleService_Service.java:56)
at com.ttdev.ss.SimpleService_P1_Client.main(SimpleService_P1_Client.java:49)
Thanks, your help is appreciated.

I also faced similar issue some time back. You may want to use a prefix "file:" before "src/main/resources". Here is the resultant code:
WSDLToJava.main(new String[] { "-client", "-d", "src/main/java",
"file:src/main/resources/SimpleService.wsdl" });

Related

How to have a wsdl conform to the soap input

We are changing our soap webservices from jetty to jaxws. The goal is to keep the same input message. I have used the original WSDL to create the service with netbeans. The WSDL is the following:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://www.mycompany.nl/DcxExpeditieService/v1"
xmlns:tns="http://www.mycompany.nl/DcxExpeditieService/v1"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xs:schema targetNamespace="http://www.mycompany.nl/DcxExpeditieService/v1"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="DcxExpeditie" type="tns:DcxExpeditie"/>
<xs:complexType name="DcxExpeditie">
<xs:sequence>
<xs:element name="Expeditie" type="tns:Expeditie"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Expeditie">
<xs:sequence>
<xs:element name="tag1" type="xs:string"/>
<xs:element name="tag2" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="DcxExpeditieRequest">
<wsdl:part name="DcxExpeditie" type="tns:DcxExpeditie"/>
</wsdl:message>
<wsdl:message name="DcxExpeditieResponse">
<wsdl:part name="DcxExpeditieResponse" type="xs:string"/>
</wsdl:message>
<wsdl:portType name="DcxExpeditieServicePortType">
<wsdl:operation name="DcxExpeditieOperation">
<wsdl:input message="tns:DcxExpeditieRequest"/>
<wsdl:output message="tns:DcxExpeditieResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="DcxExpeditieServiceSOAP" type="tns:DcxExpeditieServicePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="DcxExpeditieOperation">
<soap:operation soapAction="http://www.mycompany.nl/DcxExpeditieService/v1/DcxExpeditie"/>
<wsdl:input>
<soap:body use="literal" namespace="http://www.mycompany.nl/DcxExpeditieService/v1"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" namespace="http://www.mycompany.nl/DcxExpeditieService/v1"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="DcxExpeditieService">
<wsdl:port name="DcxExpeditieServiceSOAP" binding="tns:DcxExpeditieServiceSOAP">
<soap:address location="https://someserver.mycompany.nl/vbs/dcxexpeditie"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
When using this WSDL in soapui it results in the following input example:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.mycompany.nl/DcxExpeditieService/v1">
<soapenv:Header/>
<soapenv:Body>
<v1:DcxExpeditieOperation>
<DcxExpeditie>
<v1:Expeditie>
<v1:tag1>?</v1:tag1>
<v1:tag2>?</v1:tag2>
</v1:Expeditie>
</DcxExpeditie>
</v1:DcxExpeditieOperation>
</soapenv:Body>
</soapenv:Envelope>
However, the original input format was:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.mycompany.nl/DcxExpeditieService/v1">
<soapenv:Header/>
<soapenv:Body>
<v1:DcxExpeditie>
<v1:Expeditie>
<v1:tag1>?</v1:tag1>
<v1:tag2>?</v1:tag2>
</v1:Expeditie>
</v1:DcxExpeditie>
</soapenv:Body>
</soapenv:Envelope>
so with no DcxExpeditieOperation tag and with the v1 namespace in front of DcxExpeditie
Is this possible and if so, how can I accomplish this?
Try to change SOAP binding from rpc to document to remove DcxExpeditieOperation tag:
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
To fix the namespace issue refer DcxExpeditie element insted of type:
<wsdl:part name="DcxExpeditie" element="tns:DcxExpeditie"/>
Updated WSDL file:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://www.mycompany.nl/DcxExpeditieService/v1"
xmlns:tns="http://www.mycompany.nl/DcxExpeditieService/v1"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xs:schema targetNamespace="http://www.mycompany.nl/DcxExpeditieService/v1"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="DcxExpeditie" type="tns:DcxExpeditie"/>
<xs:element name="DcxExpeditieResponse" type="xs:string"/>
<xs:complexType name="DcxExpeditie">
<xs:sequence>
<xs:element name="Expeditie" type="tns:Expeditie"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Expeditie">
<xs:sequence>
<xs:element name="tag1" type="xs:string"/>
<xs:element name="tag2" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="DcxExpeditieRequest">
<wsdl:part name="DcxExpeditie" element="tns:DcxExpeditie"/>
</wsdl:message>
<wsdl:message name="DcxExpeditieResponse">
<wsdl:part name="DcxExpeditieResponse" element="tns:DcxExpeditieResponse" />
</wsdl:message>
<wsdl:portType name="DcxExpeditieServicePortType">
<wsdl:operation name="DcxExpeditieOperation">
<wsdl:input message="tns:DcxExpeditieRequest"/>
<wsdl:output message="tns:DcxExpeditieResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="DcxExpeditieServiceSOAP" type="tns:DcxExpeditieServicePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="DcxExpeditieOperation">
<soap:operation soapAction="http://www.mycompany.nl/DcxExpeditieService/v1/DcxExpeditie"/>
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="DcxExpeditieService">
<wsdl:port name="DcxExpeditieServiceSOAP" binding="tns:DcxExpeditieServiceSOAP">
<soap:address location="https://someserver.mycompany.nl/vbs/dcxexpeditie"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

SOAP::WSDL returns error Can't use an undefined value as an ARRAY reference

I have a perl program that is accessing a soap server. when testing the soap server via SoapUI it works, but when using my perl program I get
Can't use an undefined value as an ARRAY reference at /Library/Perl/5.18/SOAP/WSDL.pm line 222.
Here is my perl script.
use SOAP::WSDL;
my $data = 'some data here';
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
my $client = SOAP::WSDL->new( 'wsdl' => "link_to_wsdl" );
my $result = $client->call('MyMethod', $data);
use Data::Dumper;
print Dumper($result);
Here is the WSDL
<?xml version="1.0"?>
<wsdl:definitions
name="Test"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="urn:APISoapServer"
targetNamespace="urn:APISoapServer"
>
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:APISoapServer">
<xsd:element name="MyMethod">
<xsd:complexType>
<xsd:complexContent mixed="true">
<xsd:restriction base="xsd:anyType">
<xsd:sequence>
<xsd:element name="operand1" type="xsd:string" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="MyMethodResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Confirmation" maxOccurs="unbounded">
<xsd:complexType>
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:attribute name="response" type="xsd:string"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="MYAPIRequest">
<wsdl:part name="MYAPIRequestPart" element="tns:MyMethod"/>
</wsdl:message>
<wsdl:message name="MYAPIResponse">
<wsdl:part name="MYAPIResponsePart" element="tns:MyMethodResponse"/>
</wsdl:message>
<wsdl:portType name="MYAPIServerPort">
<wsdl:operation name="MyMethod">
<wsdl:input name="MyMethodInput" message="tns:MYAPIRequest"/>
<wsdl:output name="MyMethodOutput" message="tns:MYAPIResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MYAPIServerBinding" type="tns:MYAPIServerPort">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="MyMethod">
<soap12:operation style="document" soapAction="urn:APISoapServer#MyMethod" />
<wsdl:input name="MyMethodInput">
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output name="MyMethodOutput">
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MYAPIService">
<wsdl:port name="MYAPIPort" binding="tns:MYAPIServerBinding">
<soap12:address location="https://my.site.com/api/my_api_server.pl"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Wsdl webservice with matlab

I'm trying to use the function "createClassFromWsdl" with matlab and it gives me a error :
createClassFromWsdl('http://localhost/soapserver/server.php?WSDL')
Retrieving document at 'http://localhost/soapserver/server.php?WSDL'
Struct contents reference from a non-struct array object.
Error in createClassFromWsdl>parseWsdl (line 74)
se = defTypes.getExtensibilityElements().get(0);
Error in createClassFromWsdl (line 34)
[R, schema] = parseWsdl(wsdlUrl);
I have download a software called SOAPUI which works perfectly well so I can't found what is wrong...
Here is my simple wsdl file :
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:tns="http://localhost/soapserver" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://localhost/soapserver">
<wsdl:message name="printtxtSoapIn">
<wsdl:part name="txt" type="s:string"/>
</wsdl:message>
<wsdl:message name="printtxtSoapOut">
<wsdl:part name="return" type="s:string"/>
</wsdl:message>
<wsdl:portType name="SoapDemoSoap">
<wsdl:operation name="printtxt">
<wsdl:input message="tns:printtxtSoapIn"/>
<wsdl:output message="tns:printtxtSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SoapDemoSoap" type="tns:SoapDemoSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
<wsdl:operation name="printtxt">
<soap:operation soapAction="http://localhost/soapserver/printtxt"/>
<wsdl:input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/soapserver" parts="txt"/>
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/soapserver" parts="return"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SoapDemo">
<wsdl:port name="SoapDemoSoap" binding="tns:SoapDemoSoap">
<soap:address location="http://localhost/soapserver/server.php"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Perl soap::lite and complex data

I am using perl soap::lite to build a web services client.
The implementation works fine for simple methods, which will e.g. require a single scalar argument.
EG, the following works fine.
#!/usr/bin/perl
use warnings;
use SOAP::Lite +trace=>debug;
use strict;
use Data::Dumper;
$SOAP::Constants::PREFIX_ENV = 'SOAP-ENV';
my $base="https://XXXX:60001/GDBIncidentWebService/Config?wsdl&style=rpc";
my $user="XXXX";
my $pwd="XXXX";
my $lite = SOAP::Lite -> readable(1)
-> service($base) ;
my #res=$lite->readIncident("123456");
print Dumper(\#res);
exit;
sub SOAP::Transport::HTTP::Client::get_basic_credentials { return $user => $pwd ; }
I need to call one method which requires a more complex set of arguments(a few scalars plus one array of key-value pairs).
I figure I should use the SOAP::Data module to serialize my data correctly but fail to get it to work.
Even the "simple" methods (like the one above) do not seem to work.
EG (just showing lines changed from above script) :
my $arg= SOAP::Data->new()->type('xs:string')-> value("20054106");
my #res=$lite->readIncident($arg);
Yields:
String value expected instead of SOAP::Data reference
Any idea on how to fix this ? Thanks a lot !
For reference here is the wsdl for the method called in my script
<wsdl:operation name="readIncident">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal" namespace="urn:GDBIncidentWebServiceVi" parts="ticketID "/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" namespace="urn:GDBIncidentWebServiceVi"/>
</wsdl:output>
</wsdl:operation>
The full WSDL looks like follows - spread into 3 files. Main WSDL file:
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="GDBIncidentWebServiceWsd" targetNamespace="urn:GDBIncidentWebServiceWsd" xmlns:bns0="urn:GDBIncidentWebServiceWsd/Config/rpc" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:import location="./bindings/Config_rpc.wsdl" namespace="urn:GDBIncidentWebServiceWsd/Config/rpc"/>
<wsdl:service name="GDBIncidentWebService">
<wsdl:port name="ConfigPort_Rpc" binding="bns0:ConfigBinding">
<soap:address location="http://xxxx/GDBIncidentWebService/Config?style=rpc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Bindings file (extract)
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://www.w3.org/2001/XMLSchema" xmlns:ns0="urn:com.dbag.gde.gdb.types" targetNamespace="urn:GDBIncidentWebServiceWsd/GDBIncidentWebServiceVi/rpc" xmlns:tns="urn:GDBIncidentWebServiceWsd/GDBIncidentWebServiceVi/rpc" xmlns:ns2="urn:java/lang">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:com.dbag.gde.gdb.types" xmlns:tns="urn:com.dbag.gde.gdb.types" elementFormDefault="qualified">
<xs:complexType name="KeyValuePair">
<xs:sequence>
<xs:element name="key" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="value" type="xs:string" nillable="true" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ArrayOfKeyValuePair">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="KeyValuePair" type="tns:KeyValuePair" nillable="true"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:java/lang" xmlns:tns="urn:java/lang" elementFormDefault="qualified">
<xs:complexType name="ArrayOfString">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="String" type="xs:string" nillable="true"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="createInsourcingIncidentIn">
<wsdl:part name="externalKey" type="ns1:string"/>
<wsdl:part name="title" type="ns1:string"/>
<wsdl:part name="description" type="ns1:string"/>
<wsdl:part name="impact" type="ns1:string"/>
<wsdl:part name="urgency" type="ns1:string"/>
<wsdl:part name="contact" type="ns1:string"/>
<wsdl:part name="creatorGroup" type="ns1:string"/>
<wsdl:part name="category1" type="ns1:string"/>
<wsdl:part name="category2" type="ns1:string"/>
<wsdl:part name="category3" type="ns1:string"/>
<wsdl:part name="extReference" type="ns0:ArrayOfKeyValuePair"/>
<wsdl:part name="attachments" type="ns0:ArrayOfAttachment"/>
<wsdl:part name="additionalFields" type="ns0:ArrayOfKeyValuePair"/>
<wsdl:part name="assignmentGroup" type="ns1:string"/>
<wsdl:part name="assignmentSubGroup" type="ns1:string"/>
<wsdl:part name="productId" type="ns1:string"/>
<wsdl:part name="productName" type="ns1:string"/>
<wsdl:part name="service" type="ns1:string"/>
<wsdl:part name="customer" type="ns1:string"/>
</wsdl:message>
<wsdl:portType name="GDBIncidentWebServiceVi_Rpc">
<wsdl:operation name="createInsourcingIncident">
<wsdl:input message="tns:createInsourcingIncidentIn"/>
<wsdl:output message="tns:createInsourcingIncidentOut"/>
</wsdl:operation>
</wsdl:portType>
</wsdl:definitions>
Operation definition
<wsdl:operation name="createInsourcingIncident">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal" namespace="urn:GDBIncidentWebServiceVi" parts="externalKey title description impact urgency contact creatorGroup category1 category2 category3 extReference attachments additionalFields assignmentGroup assignmentSubGroup productId productName service customer "/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" namespace="urn:GDBIncidentWebServiceVi"/>
</wsdl:output>
</wsdl:operation>
Update and resolution.
It looks like using the proxy/uri method to create the SOAP::Lite object (instead of simply referencing the WSDL "service") strings is mandatory if you want to pass complex data
Therefore the code now looks as follows for the simple request :
my $base="https://XXXXX/GDBIncidentWebService/Config?wsdl&style=rpc";
my $uri="urn:GDBIncidentWebServiceVi"
my $ticketID='20054106';
my $lite = SOAP::Lite -> proxy($base)
-> uri($uri);
my $res = $lite -> readIncident(SOAP::Data->('ticketID' => $ticketID))
-> result;
print Dumper($res);

How to built SOAP Header namespaces based on the WSDL file

I've been experiencing some issues with the header presentation of a SOAP Request. I think I'm missing something.
My (partial) wsdl looks like this:
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:aws="http://xml.xxx.com"
xmlns:security_authenticate_6_1="http://xml.xxx.com/VLSSLQ_06_1_1A"
xmlns:security_authenticatereply_6_1="http://xml.xxx.com/VLSSLR_06_1_1A"
targetNamespace="http://xml.xxx.com">
<wsdl:types>
<xsd:schema targetNamespace="http://xml.xxx.com">
<xsd:import namespace="http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd" schemaLocation="WBS_Session-2.0.xsd"/>
<xsd:import namespace="http://xml.xxx.com/VLSSLQ_06_1_1A" schemaLocation="Security_Authenticate_06_1_1A.xsd"/>
<xsd:import namespace="http://xml.xxx.com/VLSSLR_06_1_1A" schemaLocation="Security_AuthenticateReply_06_1_1A.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="Session" xmlns:ns0="http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd">
<wsdl:part name="Session" element="ns0:Session"/>
</wsdl:message>
<wsdl:message name="Security_Authenticate_6_1">
<wsdl:part name="Security_Authenticate_6_1" element="security_authenticate_6_1:Security_Authenticate"/>
</wsdl:message>
<wsdl:message name="Security_AuthenticateReply_6_1">
<wsdl:part name="Security_AuthenticateReply_6_1" element="security_authenticatereply_6_1:Security_AuthenticateReply"/>
</wsdl:message>
<wsdl:portType name="XXXWebServicesPT">
<wsdl:operation name="Security_Authenticate">
<wsdl:input message="aws:Security_Authenticate_6_1"/>
<wsdl:output message="aws:Security_AuthenticateReply_6_1"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="XXXWebServicesBinding" type="aws:XXXWebServicesPT">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Security_Authenticate">
<soap:operation soapAction="http://webservices.xxx.com/1ASIWJTUTUA/VLSSLQ_06_1_1A"/>
<wsdl:input>
<soap:header message="aws:Session" part="Session" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:header message="aws:Session" part="Session" use="literal"/>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="XXXWebServices">
<wsdl:port name="XXXWebServicesPort" binding="aws:XXXWebServicesBinding">
<soap:address location="https://test.webservices.xxx.com"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I want to access the Security_Authenticate action, in which case, the header must look something like:
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>
<soapenv:Header>
<wbs:Session xmlns:wbs='http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd'>
<wbs:SessionId></wbs:SessionId>
<wbs:SequenceNumber></wbs:SequenceNumber>
<wbs:SecurityToken></wbs:SecurityToken>
</wbs:Session>
</soapenv:Header>
<soapenv:Body>
<vls:Security_Authenticate>
<vls:tagX>
<vls:tagY>yyy</vls:tagY>
<vls:tagZ>Z</vls:tagZ>
</vls:tagX>
</vls:Security_Authenticate>
</soapenv:Body>
</soapenv:Envelope>
How should I built my soapenvelope and my header namespaces?
Thanks.
You have to declare the namespace before you use the object in the xsd, so in your case, to use the Session object:
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>
<soapenv:Header>
<wbs:Session xmlns:wbs='http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd'>
<wbs:SessionId></wbs:SessionId>
<wbs:SequenceNumber></wbs:SequenceNumber>
<wbs:SecurityToken></wbs:SecurityToken>
</wbs:Session>
</soapenv:Header>
...