Author |
Message
|
SANTYP |
Posted: Wed Jul 14, 2010 3:48 am Post subject: Character String to XML Structure |
|
|
 Centurion
Joined: 27 Mar 2007 Posts: 142
|
Hi Guys,
I am getting an soap request in character string format,
I need to convert that into XMLNSC format before hitting the service..
how can I achive this |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jul 14, 2010 4:05 am Post subject: Re: Character String to XML Structure |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
SANTYP wrote: |
how can I achive this |
Using the method described in the documentation or frequently on this forum.
What have you tried so far (if anything)? What happened? Error messages? Unexpected document structure?
How is this request arriving? HTTP? WMQ? Winged monkeys?
Does the request have a WSDL?
The answers to these questions should provide you with food for thought. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
krypton |
Posted: Wed Jul 14, 2010 6:40 am Post subject: |
|
|
 Disciple
Joined: 14 Mar 2010 Posts: 186
|
Quote: |
Using the method described in the documentation or frequently on this forum.
What have you tried so far (if anything)? What happened? Error messages? Unexpected document structure?
How is this request arriving? HTTP? WMQ? Winged monkeys?
Does the request have a WSDL?
The answers to these questions should provide you with food for thought. |
Let me add more on behalf of my colleague, we are calling a webservice using HTTP Input node, to test it we are passing that request to HTTP INput node in the following manner.
Our Input is XML message wrapped in SOAP envelope and the way we tested it is
SOAPUI --> HTTPInput NOde -> HTTPRequest Node and we got a sucess response from the Webservice.
Now, in real scenrio our Input would be coming from another SOAP message, so what we are doing is
InputMessage(from another Webservice) --> HTTPINput Node--> SOAPExtractNode --> SOAPEnvelopeNode-->HTTPRequest.
But the above call got failed, then we used the debugger to compare the message before HTTPRequest node, and it was exactly same in both the cases(including SOAP envelope) etc.
We tried to compare the request of HTTPRequest node in both the cases using a dummy webservice and we found that the first request is sending a XML message in a proper formatted XML, whereas the second flow is sending the XML request to webservice in a single string line(with no format).
That is the only difference we could find, dont know whether that is the root cause and what we can do to fix this.
Thanks |
|
Back to top |
|
 |
smdavies99 |
Posted: Wed Jul 14, 2010 6:57 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Are you seeing XML in both cases but in one there are no line breaks at the end of tags?
AFAIK, both are equally valid XML. After all XML describes what is inside the tags and CR/LF's are usually ignored by most parsers.
I've use XML both with & without line breaks (CR/LF or whatever is the default on your Operating System) successfully.
There are times when putting all the XML on one line is the best way.
One such example is where you are reading the records from a file and each line is a complete message. You can have thousands of records/messages in a single file that are easily separated wheras if you had CR/LF after every close tag then you would have to build up a message in memory whilst you look for the root close tag before sending your message.
For example
Code: |
<Message><One>All</One><Two>On</Two><Three>One</Three><Four>Line</Line></Message>
|
If you take the above messagr and open it in say RFHUTIL and set the format to XML you see it all nicely indented.
I'm sure that someone here may well be able to quote the section of the XML standard that sorts all this out. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jul 14, 2010 8:25 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
smdavies99 wrote: |
I'm sure that someone here may well be able to quote the section of the XML standard that sorts all this out. |
It's here I believe.
But it's true that both methods are valid XML, it's just a case of how they're display. RFHUtil (and XMLSpy if you ask it to) will pretty-print XML to put one tag on one line but it doesn't change the meaning nor how line line breaks and other white space appears (or not) in the WMB message tree.
To save someone else the trouble, I'll say it - don't use the debugger. Take a user trace. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jul 14, 2010 11:11 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
...the first request is sending a XML message in a proper formatted XML, whereas the second flow is sending the XML request to webservice in a single string line(with no format).
|
As others have already pointed out, both forms of XML are equally valid. I know what you mean, but 'proper formatted XML' is not the correct way to talk about it. The single-line version is just as commonly used, and just as correct.
Quote: |
That is the only difference we could find, dont know whether that is the root cause and what we can do to fix this. |
I would love to offer some advice at this point, but it's rather tricky to do that when I have no idea what the symptoms are. 'Root cause' of what, exactly? Could you at least quote an error message, or tell us what happened, or what didn't happen? |
|
Back to top |
|
 |
SANTYP |
Posted: Wed Jul 14, 2010 9:07 pm Post subject: |
|
|
 Centurion
Joined: 27 Mar 2007 Posts: 142
|
[quote="kimbert"]
Quote: |
'Root cause' of what, exactly? Could you at least quote an error message, or tell us what happened, or what didn't happen? |
As previously mentioned.we are trying in 2 ways..
case1:
when we are directly hitting the service
flow structure; [http input --> http request --> http reply]
we are getting successful response
like below
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ug="some namespace">
<soapenv:Header/>
<soapenv:Body>
<ug:results>
Success
</ug:results>
</soapenv:Body>
</soapenv:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml;charset=utf-8
Content-Length: 435
Date: Thu, 15 Jul 2010 04:56:44 GMT
Server: Apache-Coyote/1.1
case2:
when we are using soap extract and saop envelope nodes
request itself comming in Response.
flow structure: [http input --> soap extract--> soapenvelop-->http request --> http reply]
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml;charset=utf-8
Content-Length: 4647
Date: Thu, 15 Jul 2010 04:55:46 GMT
Server: Apache-Coyote/1.1
Connection: close
case2 we need to implement..
I mentioned sample flow structure we need do manipulate message in b/w extract and envelope nodes. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jul 14, 2010 11:30 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
case2:
when we are using soap extract and saop envelope nodes
request itself comming in Response. |
I presume this is wrong ( although you have not actually said so). That means that the response message is being constructed wrongly, or the wrong branch of your flow is being executed.
In other words, this is basic message flow debugging - what am I missing here? Have you tried stepping through the flow using the debugger? Have you taken a user trace? |
|
Back to top |
|
 |
SANTYP |
Posted: Thu Jul 15, 2010 1:44 am Post subject: |
|
|
 Centurion
Joined: 27 Mar 2007 Posts: 142
|
Problem has been solved from service provider end..
Its an issue with their xml format handling
Thanks all the guys.. for your support. |
|
Back to top |
|
 |
|