Author |
Message
|
Armageddon123 |
Posted: Fri Mar 14, 2014 3:01 am Post subject: Namespace and SOAPRequest node. |
|
|
Acolyte
Joined: 11 Feb 2014 Posts: 61
|
Hi Experts,
Need your help!
I have an issue while creating a message definition file for a wsdl.
For the SOAP Request message, the children of the Body element doesnot have any namespace. is this allowed as per standards?
I created the wsdl for the same. It validated fine on WMB Toolkit(right click the file -Validate). But when i try to use the same wsdl to create a message defnition file (which will be used in SOAPRequest node). it fails while importing. saying wsdl is not valid.
Can you guys please advise if SOAP Request xmls should have namespace for all the children of the Body Element.
Here is the request xml
Code: |
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">;
<soap:Body>
<MainService>
<RequestString>string</RequestString>
</MainService>
</soap:Body>
</soap:Envelope> |
Here is the wsdl created for the same
Code: |
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"; xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; xmlns:s="http://www.w3.org/2001/XMLSchema"; xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"; xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">;
<wsdl:types>
<s:schema elementFormDefault="qualified">
<s:element name="MainService">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="RequestString" type="string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="MainServiceResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ResponseResult" type="string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="ProcessSoapIn">
<wsdl:part name="parameters" element="MainService" />
</wsdl:message>
<wsdl:message name="ProcessSoapOut">
<wsdl:part name="parameters" element="MainServiceResponse" />
</wsdl:message>
<wsdl:portType name="ProviderServiceSoap">
<wsdl:operation name="MainService">
<wsdl:input message="ProcessSoapIn" />
<wsdl:output message="ProcessSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ProviderServiceSoap" type="ProviderServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"; />
<wsdl:operation name="MainService">
<soap:operation style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ProviderServiceSoapService">
<wsdl:port name="ProviderServiceSoap" binding="ProviderServiceSoap">
<soap:address location="http:demo:4670/abc/a.asmx"; />
</wsdl:port>
</wsdl:service>
</wsdl:definitions> |
Please note that the xml and wsdl are modified to remove the client info.
I checked for the SOAP standards.
As per http://www.w3.org/TR/2000/NOTE-SOAP-20000508/ section 4.3 'SOAP Body' says-
Quote: |
A body entry is identified by its fully qualified element name, which consists of the namespace URI and the local name. Immediate child elements of the SOAP Body element MAY be namespace-qualified. |
But as per http://www.ws-i.org/profiles/basicprofile-1.1-2004-08-24.html,
Quote: |
3.1.3 SOAP Body Namespace Qualification
The use of unqualified element names may cause naming conflicts, therefore qualified names must be used for the children of soap:Body.
R1014 The children of the soap:Body element in an ENVELOPE MUST be namespace qualified.
|
So, slightly confused, if the elements under Body should have namespace or not..
Another observation is- in SOAPRequest node, the Target namespace field is not editable. I am guessing that WMB accepts only those with namespace for the Body elements.
Can you please advise me on this.
Thanks |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Mar 14, 2014 3:09 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
What have you tried? What did you find out?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Armageddon123 |
Posted: Fri Mar 14, 2014 3:34 am Post subject: |
|
|
Acolyte
Joined: 11 Feb 2014 Posts: 61
|
Hi fjb_saper,
When i tried to create messagedefintion file using this wsdl, it fails with error while creating
"Error loading WSDL file check WSDL for validity".
But the wsdl validates when using Validate option.
Then i added namespace for the wsdl and it imported fine.
This means that WMB toolkit needs the Body elements to have namespace.
But the same WSDL(without namespace) is validating fine on the toolkit and also the w3.org doesnot say that namespace is mandatory for the child elements of Body.
Am i missing something ?.
Thanks |
|
Back to top |
|
 |
ganesh |
Posted: Fri Mar 14, 2014 5:44 am Post subject: |
|
|
Master
Joined: 18 Jul 2010 Posts: 294
|
The error which you get when trying to import and create a message definition does it only say wsdl is invalid?
You might want to validate the same wsdl using a different tool like altova and see if the wsdl is valid and well formed.
If you change this ---> <s:schema elementFormDefault="qualified">
to -----> <s:schema elementFormDefault="unqualified"> , then the wsdl will accept xml's where the child elements do not have namespace explicitly set. |
|
Back to top |
|
 |
Armageddon123 |
Posted: Tue Mar 18, 2014 3:38 am Post subject: |
|
|
Acolyte
Joined: 11 Feb 2014 Posts: 61
|
Hi ganesh.
Thanks for the reply.
The error in toolkit is only WSDL invalid error.
btw, i see now that the orginal wsdl posted from me has several semicolons( ; ) extra to what i tried to paste in the forum(i dont know how that came in!!!!).
The wsdl is validating fine on other tools as well.
I tried with the "unqualified" change and but still it is not able to create the message definition.
One observation i have is the wsdl i created doesnot have a targetnamespace value. (but it is mandatory for Toolkit Messgedefinition?)
So I am still trying to figure out a way to have a targetnamespace value present in the wsdl but at the same time add something else in the wsdl so that the child elements of the Body element donot need to have a namespace. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Mar 18, 2014 5:36 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I am still trying to figure out a way to have a targetnamespace value present in the wsdl but at the same time add something else in the wsdl so that the child elements of the Body element donot need to have a namespace. |
Well, there's the 'elementFormDefault' attribute. It is an XML Schema attribute that controls whether local element definitions need to be namespace-qualified.
I'm not saying that it is what you need. I'm just offering it as a possible solution. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
|