ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Convert xml message to SOAP message (SOAP Request)

Post new topic  Reply to topic
 Convert xml message to SOAP message (SOAP Request) « View previous topic :: View next topic » 
Author Message
mehdiK
PostPosted: Tue Apr 23, 2013 4:08 am    Post subject: Convert xml message to SOAP message (SOAP Request) Reply with quote

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
View user's profile Send private message
RAJASHEKAR REDDY
PostPosted: Sun May 12, 2013 11:49 pm    Post subject: Reply with quote

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
View user's profile Send private message
RAJASHEKAR REDDY
PostPosted: Sun May 12, 2013 11:53 pm    Post subject: Reply with quote

Novice

Joined: 09 May 2013
Posts: 13

Better to Add SoapEnvolope Node befor the JavaCompute node
Back to top
View user's profile Send private message
mgk
PostPosted: Mon May 13, 2013 2:49 am    Post subject: Reply with quote

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
View user's profile Send private message
bharathi.tech12
PostPosted: Thu May 23, 2013 9:52 am    Post subject: adding namespace Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Thu May 23, 2013 9:59 am    Post subject: Reply with quote

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
View user's profile Send private message
bharathi.tech12
PostPosted: Thu May 23, 2013 10:18 am    Post subject: Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Thu May 23, 2013 10:23 am    Post subject: Reply with quote

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
View user's profile Send private message
bharathi.tech12
PostPosted: Thu May 23, 2013 10:31 am    Post subject: Reply with quote

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
View user's profile Send private message
kash3338
PostPosted: Thu May 23, 2013 8:51 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Convert xml message to SOAP message (SOAP Request)
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.