Problem on document structure when exposing a webservice

Hello,

I’ve got a problem when I try to manipulate the soap request in a service exposed as a webservice (soap msg).

I’ve developped a testing service and I see that the soap request is well-formed.

<?xml version="1.0" encoding="UTF-8"?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:SOAP-ENC=“http://schemas.xmlsoap.org/soap/encoding/” xmlns:xsd=“http://www.w3.org/2001/XMLSchema” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”>
SOAP-ENV:Body
<tns1:troubleticket xmlns:tns1=“http://localhost/PH_SAV_FTPH_SPAS/TroubleTicket/source/services/handleTT”>

CLTT
tns1:troubleticket.system.subactioncode
SAS
OCEANE

tns1:troubleticket.system.sfu.code
tns1:troubleticket.system.sfu.label



tns1:troubleticket.system.isticketid.ticketid.objid
tns1:troubleticket.system.isticketid.ticketid.id
tns1:troubleticket.system.isticketid.ticketid.subid




tns1:troubleticket.system.msticketid.ticketid.objid
tns1:troubleticket.system.msticketid.ticketid.id
tns1:troubleticket.system.msticketid.ticketid.subid



tns1:troubleticket.system.agent.agentsystem

tns1:troubleticket.system.agent.ticketid.objid
tns1:troubleticket.system.agent.ticketid.id
tns1:troubleticket.system.agent.ticketid.subid


tns1:troubleticket.system.agent.group.id
tns1:troubleticket.system.agent.group.label


tns1:troubleticket.system.agent.role.id
tns1:troubleticket.system.agent.role.label



[…]
</tns1:troubleticket></SOAP-ENV:Body>
</SOAP-ENV:Envelope>

When I want to get the body node as a document, I obtain the following result : see attached doc troubleticket_in_pipeline.JPG

I use the built-in service to obtain the document from the body : xmlNodeToDocument with the following parameters :
input :
soapRequest *body -> *node
makeArrays set to false
nsDecls set with an element (spas set to http://localhost/PH_SAV_FTPH_SPAS/TroubleTicket/source/services/handleTT)
output
document -> troubleticket (reference)

The structure of the troubleticket is exposed in the attached doc : troubleticket_document.JPG

In fact, i dontt understand why I obtain an added node in the result of the xmlNodeToDocument :

spas:troubleticket

I’ve attached my zipped code in the PH_SAV_FTPH_SPAS.zip file.
The service exposed is : PH_SAV_FTPH_SPAS.TroubleTicket.source.services:handleTT

Thank you in advance for your ideas !

Christophe
troubleticket_in_pipeline.JPG
troubleticket_document.JPG
PH_SAV_FTPH_SPAS.zip (43.1 KB)

Hello,
The problem is with the document type you defined as input PH_SAV_FTPH_SPAS.TroubleTicket.internal.docType.wsdl:TroubleTicket. Look at it. There are three levels: Leve1- TroubleTicket, Level2- troubleticket and level3-The other segments. As all the segments are defined under one root document an extra ‘troubleticket’ document is coming in the request data. It is obvious from the document type you defined. To overcome this,

  1. either you have to take ‘spas:troubleticket’ (spas is namespace name) under ‘document’ of ‘xmlNodeToDocument’ and then map it to the output document trouble ticket.
  2. or Create a WSDL that defines ‘PH_SAV_FTPH_SPAS.TroubleTicket.internal.docType:troubleticket’ as input for this service and give it to your customer. Use this document in the ‘xmlNodeToDocument’ service as the output doc.

Cheers
Guna

Thank you tgunasekhar,

I have tried to follow the process described by Mark Carlson in this thread : http://wmusers.com/forum/showthread.php?t=9277

In fact, I don’t understand where I must use the document PH_SAV_FTPH_SPAS.TroubleTicket.internal.docType.wsdl:TroubleTicket.

When I call the xmlNodeToDocument service, I use PH_SAV_FTPH_SPAS.TroubleTicket.internal.docType:troubleticket as documentTypeName and I map the result to PH_SAV_FTPH_SPAS.TroubleTicket.internal.docType:troubleticket again.

According to my short experience, “spas” is a namespace prefix. It is not mandatory in soap protocol. So, I don’t understand why I should reference it in the document troubleticket. This prefix could be named “toto” or nothing ?!

Other precision : The wsdl is maintened by my client, so I can’t modify it.

Christophe

PS : Hope that my poor english is understanding …

In the sample given by Mark Carlson, you can see the step: xmlNodeToDocument. He did exactly what I said in step-1 of my previous answer

And you missed it in your implementation. Have a look at both your service and Mark’s example.

Cheers
Guna

Thanx a lot Guna. I’ve not seen that there was a node under document of xmlNodeToDocument.
And I’ve have not understood your answer. Sorry.

But what is the purpose of the documentType that Mark Carlson has created in the folder wsdl ? That is for the generation of the wsdl ?

Best regards.

Christophe

I’ve now an other problem.
The dimension of a few nodes is lost (document list is transformed into single string ).
Note : The document that I send is empty for these nodes.

This commonly occurs when you don’t provide a documentType to the nodeToDocument call. If the tag appears a single time in the node, the service by default only knows to create a document and not a document list. You can fix this by defining the element names which repeat or by supplying a fully qualified document type name containing the structure.

Mark

Thank you mark for your answer.

But I provide a documentTypeName to the service xmlNodeToDocument with makearrays = false. So, I don’t understand where the problem is…

Actually, I call the webservice with empty values or lists for most of the nodes.
I’ve tried by populate the lists. It doesn’t work.

Hello,
for the service ‘xmlNodeToDocument’ give the name of all the multiple occuring segments (agent, site, etc) as input to ‘Arrays’. Set make arrays as ‘true’ and remove the document type name value. This works.

Cheers
Guna

Effectively. It is the solution at least.

But is it a bug in the service xmlNodeToDocument ?

Why it is not able to use correctly the documentTypeName that I’ve provided. Is it a problem of structure in the document ?

I use this service in other parts of the code and it works fine with the documentTypeNames that I provide.

I’ve seen a few concerns about this service on the forum and the answers are not clear.

An other difficulties in defining arrays and documents nodes in the input of xmlNodeToDocument is when an element is define as a document in a sub-structure and as a string in an other sub-structure (see diagnostic in my example troubleticket)

Christophe May I ask how you overcame this problem.

I am also facing a similar problem where I am trying to build a custom SOAP processor and it is so dependent on the structure and the introduction of this additional tag is making my service go haywire…

I have pretty much done exactly what you have done and stuck with the same problem.

Do help.

I am sorry I am unable to understand what you mentioned in you last post.
Anway were you able to overcome your problem , if so how?