|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
NameSpace Issue: |
« View previous topic :: View next topic » |
Author |
Message
|
madhu |
Posted: Thu Aug 23, 2007 3:55 pm Post subject: NameSpace Issue: |
|
|
Novice
Joined: 09 Jul 2003 Posts: 22
|
I am trying to call a webservice by creating soap message in a compute node. I am getting an error while referencing the child object.
My WSDL looks like
Code: |
<schema targetNamespace="http://data" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns4="http://QT" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<import namespace="http://QT"/>
<complexType name="ResultContainer">
<sequence>
<element name="objEmployee" nillable="true" type="tns4:Employee"/>
<element name="objTicketCa" nillable="true" type="tns4:TicketCA"/>
<element name="objTicketOccurence" nillable="true" type="tns4:TicketOccurence"/>
</sequence>
</complexType>
</schema>
|
All the three objects are from the same namespace (http://QT).
TicketOccurence contains employee objet which is also from the same namespace.
Code: |
<complexType name="TicketOccurence">
<sequence>
<element name="employee" nillable="true" type="tns4:Employee"/>
<element name="ticketType" nillable="true" type="xsd:string"/>
<element name="occCode" type="xsd:int"/>
------------ |
I don't have any problem in setting the objEmployee which is directly under the input. But when I try to set the employee object under objTicketOccurence by using following code
Code: |
SETOutputRoot.XMLNS.mySoapNS:Envelope.mySoapNS:Body.myNS1:executeEzPayRules.input.objTicketOccurence.employee.utuCraftDate = InputRoot.MRM.QT_BRE_REQUEST_DATA.REQ_EMPLOYEE.REQ_UTU_CRAFT_DT;
|
I get the following error on the app server.
Error:org.xml.sax.SAXException: WSWS3047E: Error: Cannot deserialize element employee of bean data.ResultContainer.
Child element employee does not belong in namespace .
Most likely, a third-party web services platform has sent an incorrect SOAP message
Even If I specify the namespace,
Code: |
SETOutputRoot.XMLNS.mySoapNS:Envelope.mySoapNS:Body.myNS1:executeEzPayRules.input.objTicketOccurence.myNS3:employee.utuCraftDate = InputRoot.MRM.QT_BRE_REQUEST_DATA.REQ_EMPLOYEE.REQ_UTU_CRAFT_DT; |
it still doesn't recognize the element and says child element does not belong in namespace http:\\QT.
Appreciate your help. _________________ madhu |
|
Back to top |
|
 |
elvis_gn |
Posted: Thu Aug 23, 2007 9:20 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi madhu,
What is myNS3 ?
Why does the child element not have the same namespace prefix as the parent ?
Have you declared the namespace for this myNS3 ?
Can we please have the output message structure...i.e xsd.
And also the current output message structure that your code is generating.
Regards. |
|
Back to top |
|
 |
madhu |
Posted: Thu Aug 23, 2007 10:02 pm Post subject: |
|
|
Novice
Joined: 09 Jul 2003 Posts: 22
|
myNS3 is the name space declaration.
These are the name spaces I am using.
Code: |
DECLARE mySoapNS NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';
DECLARE myNS1 NAMESPACE 'http://services.ezpay.bnsf.com';
DECLARE myNS2 NAMESPACE 'http://mw.soa.bnsf.com';
DECLARE myNS3 NAMESPACE 'http://QT';
DECLARE resultNS NAMESPACE 'http://data';
DECLARE myXSI NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';
DECLARE myXSD NAMESPACE 'http://www.w3.org/2001/XMLSchema'; |
output structure should be like:
please read this code from bottom to top
Code: |
<schema targetNamespace="http://QT" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<complexType name="Employee">
<sequence>
<element name="emplStartDate" nillable="true" type="xsd:dateTime"/>
.
.
.
</sequence>
</complexType>
<complexType name="TicketCA">
<sequence>
<element name="caCode" nillable="true" type="xsd:string"/>
.
.
</sequence>
</complexType>
<complexType name="TicketOccurence">
<sequence>
<element name="employee" nillable="true" type="tns4:Employee"/>
<element name="ticketType" nillable="true" type="xsd:string"/>
.
.
.
</sequence>
</complexType>
<schema targetNamespace="http://data" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns4="http://QT" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<import namespace="http://QT"/>
<complexType name="ResultContainer">
<sequence>
<element name="objEmployee" nillable="true" type="tns4:Employee"/>
<element name="objTicketCa" nillable="true" type="tns4:TicketCA"/>
<element name="objTicketOccurence" nillable="true" type="tns4:TicketOccurence"/>
</sequence>
</complexType>
</schema>
<element name="executeEzPayRules">
<complexType>
<sequence>
.
.
<element name="input" nillable="true" type="tns3:ResultContainer"/>
</sequence>
</complexType>
</element> |
This is the esql to format the output:
Code: |
1 SET OutputRoot.XMLNS.mySoapNS:Envelope.mySoapNS:Body.myNS1:executeEzPayRules.(XML.NamespaceDecl)xmlns:ns1 = 'http://services.ezpay.bnsf.com';
SET OutputRoot.XMLNS.mySoapNS:Envelope.mySoapNS:Body.myNS1:executeEzPayRules.(XML.NamespaceDecl)mySoapNS:encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
-- set objEmployee filelds
2 SET OutputRoot.XMLNS.mySoapNS:Envelope.mySoapNS:Body.myNS1:executeEzPayRules.input.objEmployee.emplStartDate = InputRoot.MRM.QT_BRE_REQUEST_DATA.REQ_EMPLOYEE.REQ_START_DT ;
SET OutputRoot.XMLNS.mySoapNS:Envelope.mySoapNS:Body.myNS1:executeEzPayRules.input.objEmployee.emplStartDate.(XML.Attribute)myXSI:type = 'xsd:dateTime';
-- set objTicketCa fields
3 SET OutputRoot.XMLNS.mySoapNS:Envelope.mySoapNS:Body.myNS1:executeEzPayRules.input.objTicketCa.caCode = InputRoot.MRM.QT_BRE_REQUEST_DATA.REQ_CA.REQ_CA_CODE;
SET OutputRoot.XMLNS.mySoapNS:Envelope.mySoapNS:Body.myNS1:executeEzPayRules.input.objTicketCa.caCode.(XML.Attribute)myXSI:type = 'xsd:string';
--set objTicketOccurence fields
-- set the employee fields
4 SET OutputRoot.XMLNS.mySoapNS:Envelope.mySoapNS:Body.myNS1:executeEzPayRules.input.objTicketOccurence.employee.emplStartDate = InputRoot.MRM.QT_BRE_REQUEST_DATA.REQ_EMPLOYEE.REQ_START_DT;
SET OutputRoot.XMLNS.mySoapNS:Envelope.mySoapNS:Body.myNS1:executeEzPayRules.input.objTicketOccurence.employee.emplStartDate.(XML.Attribute)myXSI:type = 'xsd:dateTime';
-- set remaining fields
5 SET OutputRoot.XMLNS.mySoapNS:Envelope.mySoapNS:Body.myNS1:executeEzPayRules.input.objTicketOccurence.ticketType = InputRoot.MRM.QT_BRE_REQUEST_DATA.REQ_TICKET_OCCUR.REQ_TICKET_TYPE;
SET OutputRoot.XMLNS.mySoapNS:Envelope.mySoapNS:Body.myNS1:executeEzPayRules.input.objTicketOccurence.ticketType.(XML.Attribute)myXSI:type = 'xsd:string';
|
Above Statement 2 is working and Statement 4 is giving the error.
Here is the trace before calling the web service:
Code: |
(0x01000000):HTTPRequestHeader = (
(0x03000000):SOAPAction = ''
)
(0x01000010):XMLNS = (
(0x05000018): = (
(0x02000000): = ''
(0x06000011): = '1.0'
(0x06000012): = 'UTF-8'
)
(0x01000000)http://schemas.xmlsoap.org/soap/envelope/:Envelope = (
(0x07000012)xmlns:SOAP-ENV = 'http://schemas.xmlsoap.org/soap/envelope/'
(0x07000012)xmlns:xsi = 'http://www.w3.org/2001/XMLSchema-instance'
(0x07000012)xmlns:xsd = 'http://www.w3.org/2001/XMLSchema'
(0x01000000)http://schemas.xmlsoap.org/soap/envelope/:Body = (
(0x01000000)http://services.ezpay.bnsf.com:executeEzPayRules = (
(0x07000012)xmlns:ns1 = 'services.ezpay.bnsf.com'
(0x07000012)http://schemas.xmlsoap.org/soap/envelope/:encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'
(0x01000000):header = (
(0x01000000):serviceCreateTime = (
(0x03000000)http://www.w3.org/2001/XMLSchema-instance:type = 'xsd:string'
)
(0x01000000):serviceRequestor = (
(0x03000000)http://www.w3.org/2001/XMLSchema-instance:type = 'xsd:string'
)
(0x01000000):serviceName = (
(0x03000000)http://www.w3.org/2001/XMLSchema-instance:type = 'xsd:string'
)
(0x01000000):serviceReturnText = (
(0x03000000)http://www.w3.org/2001/XMLSchema-instance:type = 'xsd:string'
)
(0x01000000):serviceReturnCode = (
(0x03000000)http://www.w3.org/2001/XMLSchema-instance:type = 'xsd:string'
)
)
(0x01000000):input = (
(0x01000000):objEmployee = (
(0x01000000):emplStartDate = (
(0x02000000): = '2007-08-16T16:05:42.270Z'
(0x03000000)http://www.w3.org/2001/XMLSchema-instance:type = 'xsd:dateTime'
)
(0x01000000):utuCraftDate = (
(0x02000000): = '2007-08-16T16:05:42.270Z'
(0x03000000)http://www.w3.org/2001/XMLSchema-instance:type = 'xsd:dateTime'
)
)
(0x01000000):objTicketCa = (
(0x01000000):caCode = (
(0x02000000): = 'CP'
(0x03000000)http://www.w3.org/2001/XMLSchema-instance:type = 'xsd:string'
)
(0x01000000):autoDeclRem = (
(0x02000000): = ''
(0x03000000)http://www.w3.org/2001/XMLSchema-instance:type = 'xsd:string'
)
)
(0x01000000):objTicketOccurence = (
(0x01000000):employee = (
(0x01000000):emplStartDate = (
(0x02000000): = '2007-08-16T16:05:42.270Z'
(0x03000000)http://www.w3.org/2001/XMLSchema-instance:type = 'xsd:dateTime'
)
(0x01000000):protStatusCode = (
(0x02000000): = ''
(0x03000000)http://www.w3.org/2001/XMLSchema-instance:type = 'xsd:string'
)
)
(0x01000000):totalOnDutyTime = (
(0x02000000): = 0.0
(0x03000000)http://www.w3.org/2001/XMLSchema-instance:type = 'xsd:float'
)
(0x01000000):tktInvest = (
(0x02000000): = ''
(0x03000000)http://www.w3.org/2001/XMLSchema-instance:type = 'xsd:string'
)
)
(0x01000000):employee = (
(0x01000000):lodgingCode = (
(0x03000000)http://www.w3.org/2001/XMLSchema-instance:type = 'xsd:string'
)
)
)
)
)
)
) |
After putting the trace here , I am seeing the error i.e. employee at the bottom of the trace in wrong level. I need to check the code to see where this is coming from. _________________ madhu |
|
Back to top |
|
 |
madhu |
Posted: Thu Aug 23, 2007 11:58 pm Post subject: |
|
|
Novice
Joined: 09 Jul 2003 Posts: 22
|
Thanks elvis. That was a spelling mistake.
Your questions helped me to trace this error. I was looking at the web service error and wondering why it is complaining about the namespace.
There were nearly 100 fields that I had to set.
Is there a better way of doing this?
I am thinking of creating message defs from both wsdl and copy book and use the mapping node. Is this possible if we have multiple operations in WSDL. _________________ madhu |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Aug 24, 2007 12:14 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi madhu,
madhu wrote: |
Thanks elvis. That was a spelling mistake.
Your questions helped me to trace this error. I was looking at the web service error and wondering why it is complaining about the namespace.
There were nearly 100 fields that I had to set.
Is there a better way of doing this? |
During development, once you've made the tree structure, output it to a queue, and do a validation against the xsd..
1. Fields with unspecified namespaces will appear as NS1, NS2 etc and can be immediately identified.
2. XSD validation: Basically, all mistakes including spellings should be caught there.
During coding, don't type the names of the fields, copy-paste from the xsd directly.
madhu wrote: |
I am thinking of creating message defs from both wsdl and copy book and use the mapping node. Is this possible if we have multiple operations in WSDL. |
Yes, I suppose so.
If your web service has to deliver high performance then avoid using message sets...especially if the structures are complex.
Regards. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|