Author |
Message
|
mehdiK |
Posted: Tue Apr 23, 2013 4:08 am Post subject: Convert xml message to SOAP message (SOAP Request) |
|
|
Acolyte
Joined: 07 Mar 2013 Posts: 53
|
Hello,
I have the following flow :
HTTPInput -> Java Compute -> SOAPRequest -> SOAPExtract -> HTTPReply
What I want to do is, get a message via HTTPInput node, convert it in the Java Compute node to SOAP message, consume the webservice in the HttpRequest, and finally extract the response and send the reply through Rest.
I think that the flow is right, isn't it ?
Now I have a problem in the compute node, I think that I have to add something like (in Java) :
Code: |
SET OutputRoot.SOAP.Body = InputBody.(XMLNSC.Folder)[1].(XMLNSC.Folder)[1]; |
But it's confusing me.
Do you have any advice and any idea about this ?
Regards. |
|
Back to top |
|
 |
RAJASHEKAR REDDY |
Posted: Sun May 12, 2013 11:49 pm Post subject: |
|
|
Novice
Joined: 09 May 2013 Posts: 13
|
Hi,
Add SoapEnvlope node for add soap header.
OR
if you dont want use SoapEnvolope node , use bellow code in ESQL
SET OutputRoot.XMLNSC.nsSoapEnv:Envelope.nsSoapEnv:Body = InputRoot.XMLNSC; |
|
Back to top |
|
 |
RAJASHEKAR REDDY |
Posted: Sun May 12, 2013 11:53 pm Post subject: |
|
|
Novice
Joined: 09 May 2013 Posts: 13
|
Better to Add SoapEnvolope Node befor the JavaCompute node |
|
Back to top |
|
 |
mgk |
Posted: Mon May 13, 2013 2:49 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Actually a SOAPEnvelope node is not needed here. The SOAPRequest node will automatically add a SOAP Envelope if one is not present in the message arriving at its input terminal...
Kind regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
bharathi.tech12 |
Posted: Thu May 23, 2013 9:52 am Post subject: adding namespace |
|
|
Voyager
Joined: 14 May 2013 Posts: 93
|
Hi,
I am also trying the same. i am trying to generate the xml in java compute from json input. only thing in my soap request there is some namespace.
can any one help me how to add namespace values in the generated xml along with soap request format?
i am using java compute node and writing the java code to parese and generate the xml.
Code: |
MbElement fromCurrency = inMessage.getRootElement().getLastChild().getFirstElementByPath("/JSON/Data/fromCurrency");
MbElement toCurrency = inMessage.getRootElement().getLastChild().getFirstElementByPath("/JSON/Data/toCurrency");
MbElement outRoot = outMessage.getRootElement();
MbElement messageRoot = outRoot.createElementAsLastChild("XMLNSC");
MbElement outPut = messageRoot.createElementAsLastChild(MbXMLNSC.FOLDER,"ConversionRate",null);
outPut.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE,"FromCurrency", fromCurrency.getValue().toString());
outPut.createElementAsLastChild(MbElement.TYPE_NAME_VALUE,"ToCurrency", toCurrency.getValue().toString()); |
output:
<ConversionRate>
<FromCurrency>USD</FromCurrency>
<ToCurrency>INR</ToCurrency>
</ConversionRate>
expectiong like below,
<ConversionRate xmlns="http://www.webserviceX.NET/">
<FromCurrency>USD</FromCurrency>
<ToCurrency>INR</ToCurrency>
</ConversionRate>
with soap request details. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu May 23, 2013 9:59 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You need to add a namespace declaration to the right element.
For any element that needs to belong to the namespace, you need to set the namespace property of the element to indicate that the element belongs to the namespace. |
|
Back to top |
|
 |
bharathi.tech12 |
Posted: Thu May 23, 2013 10:18 am Post subject: |
|
|
Voyager
Joined: 14 May 2013 Posts: 93
|
mqjeff wrote: |
You need to add a namespace declaration to the right element.
For any element that needs to belong to the namespace, you need to set the namespace property of the element to indicate that the element belongs to the namespace. |
thanks for your reply.
I have used the blow line of code in my java
Code: |
messageRoot.setNamespace("http://www.webserviceX.NET/"); |
the output of the java compute node send to the Soap envelop node, but i am getting the error.
can you help me how exactly change my code? |
|
Back to top |
|
 |
mqjeff |
Posted: Thu May 23, 2013 10:23 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
That line of code sets the namespace property of an element to indicate that the element belongs to the namespace.
It does not create a namespace declaration. |
|
Back to top |
|
 |
bharathi.tech12 |
Posted: Thu May 23, 2013 10:31 am Post subject: |
|
|
Voyager
Joined: 14 May 2013 Posts: 93
|
mqjeff wrote: |
That line of code sets the namespace property of an element to indicate that the element belongs to the namespace.
It does not create a namespace declaration. |
any one |
|
Back to top |
|
 |
kash3338 |
Posted: Thu May 23, 2013 8:51 pm Post subject: |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
bharathi.tech12 wrote: |
any one |
mqjeff wrote: |
It does not create a namespace declaration. |
Which means, you have to first create namespace declaration. To do so, you need to check createElementAsLastChild function with MbXMLNSC.NAMESPACE_DECL parameter. |
|
Back to top |
|
 |
|