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 » Json to Soap & Soap to Json

Post new topic  Reply to topic
 Json to Soap & Soap to Json « View previous topic :: View next topic » 
Author Message
Android 23
PostPosted: Thu Jun 22, 2017 3:24 am    Post subject: Json to Soap & Soap to Json Reply with quote

Apprentice

Joined: 27 Mar 2017
Posts: 38

Hi Guys,
I'm trying to parse Json to soap and soap to Json .
For that i have used HttpInput->compute->Soaprequest->Compute->Httpreply node.

For converting to Soap.i have used this in first compute node code below:
Code:

DECLARE ns1 NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';
DECLARE ns NAMESPACE 'http://wisp/trans/';
CREATE COMPUTE MODULE JsonSoap_Compute
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
CREATE LASTCHILD OF OutputRoot DOMAIN 'XMLNSC';
SET OutputRoot.XMLNSC.ns1:Envelope.ns1:Header='';
SET OutputRoot.XMLNSC.ns1:Envelope.ns:Body.tran:JKResponse.Name=InputRoot.JSON.Data.JK.Add;
SET OutputRoot.XMLNSC.ns1:Envelope.ns:Body.tran:JKResponse.Add=InputRoot.JSON.Data.JK.User;
SET OutputRoot.XMLNSC.ns1:Envelope.ns:Body.tran:JKResponse.Details=InputRoot.JSON.Data.JK.Details;

      RETURN TRUE;
   END;


Input:
Quote:

{
"JK": {
"User": "test",
"Add": "Hyd",
"Details": "bait"
}
}


After converting to Soap. I got this output:
Quote:

<NS1:Envelope xmlns:NS1="http://schemas.xmlsoap.org/soap/envelope/">
<NS1:Header></NS1:Header>
<NS2:Body xmlns:NS2="http://wisp/trans/">
<NS3:JKResponse xmlns:NS3="tran">
<Name>Hyd</Name>
<Add>test</Add>
<Details>bait</Details>
</NS3:JKResponse>
</NS2:Body>
</NS1:Envelope>


I have used WSDL for Soaprequestnode.After that i got this error:


Quote:

RecoverableException
File:CHARACTER:F:\build\S1000_slot1\S1000_P\src\WebServices\WSLibrary\ImbSOAPRequestNode.cpp
Line:INTEGER:841
Function:CHARACTER:ImbSOAPRequestNode::requestData
Type:CHARACTER:ComIbmSOAPRequestNode
Name:CHARACTER:JsonSoap#FCMComposite_1_3
Label:CHARACTER:JsonSoap.SOAP Request
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:3754
Text:CHARACTER:Error occurred in ImbSOAPRequestHelper::makeSOAPRequest()
Insert
Type:INTEGER:14
Text:CHARACTER:JsonSoap.SOAP Request
RecoverableException
File:CHARACTER:F:\build\S1000_slot1\S1000_P\src\WebServices\WSLibrary\ImbSOAPRequestHelper.cpp
Line:INTEGER:2140
Function:CHARACTER:ImbSOAPRequestHelper::makeSOAPRequest
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:3701
Text:CHARACTER:Error Making JNI Call: Axis2Requester_processRequestMessageNonSoap
Insert
Type:INTEGER:5
Text:CHARACTER:Axis2Requester_processRequestMessageNonSoap
Insert
Type:INTEGER:5
Text:CHARACTER:org.apache.axiom.soap.SOAPProcessingException: Disallowed element found inside Envelope : {http://wisp/trans/}Body
Insert
Type:INTEGER:5
Text:CHARACTER:Frame : 0 org.apache.axiom.soap.SOAPProcessingException: Disallowed element found inside Envelope : {http://wisp/trans/}Body
@: org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:352)
@: org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:273)
@: org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:234)
@: org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
@: org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:678)
@: org.apache.axiom.om.impl.llom.OMElementImpl.getFirstOMChild(OMElementImpl.java:695)
@: org.apache.axiom.om.impl.llom.OMElementImpl.getFirstElement(OMElementImpl.java:993)
@: org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.getBody(SOAPEnvelopeImpl.java:165)
@: com.ibm.broker.axis2.SoapUtilities.wrapDataInSoapEnvelopeIfRequiredAvoidingAxis2(Unknown Source)
@: com.ibm.broker.axis2.Axis2Requester.processRequestMessageNonSoap(Unknown Source)


Frame : 0 org.apache.axiom.soap.SOAPProcessingException: Disallowed element found inside Envelope : {http://wisp/trans/}Body\r\n\t@: org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:352)\r\n\t@: org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:265)\r\n\t@: org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:234)\r\n\t@: org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)\r\n\t@: org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:678)\r\n\t@: org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:122)\r\n\t@: org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementImpl.java:345)\r\n\t@: org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.getBody(SOAPEnvelopeImpl.java:170)\r\n\t@: com.ibm.broker.axis2.SoapUtilities.wrapDataInSoapEnvelopeIfRequiredAvoidingAxis2(Unknown Source)\r\n\t@: com.ibm.broker.axis2.Axis2Requester.processRequestMessageNonSoap(Unknown Source)\r\n
.
I have imported SoapUI and created Soapmockservice and i have one more doubt, what URL should i give in Soaprequest node and hit it.
Please help me solve this error.
Thanks in Advance.

Regards,
Android23.
Back to top
View user's profile Send private message
Deepak.k
PostPosted: Thu Jun 22, 2017 3:40 am    Post subject: Reply with quote

Novice

Joined: 18 Aug 2016
Posts: 22

Calling a service means you should know the URL to hit
Back to top
View user's profile Send private message
Android 23
PostPosted: Thu Jun 22, 2017 3:42 am    Post subject: Reply with quote

Apprentice

Joined: 27 Mar 2017
Posts: 38

Should i declare Httpinput Url or WSDL Url or Mockservice Url to call that service.
Back to top
View user's profile Send private message
Deepak.k
PostPosted: Thu Jun 22, 2017 3:47 am    Post subject: Reply with quote

Novice

Joined: 18 Aug 2016
Posts: 22

WSDL URL
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Thu Jun 22, 2017 4:38 am    Post subject: Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 364
Location: Columbus, OH

Your SOAP message is invalid.

Code:

<NS1:Envelope xmlns:NS1="http://schemas.xmlsoap.org/soap/envelope/">
<NS1:Header></NS1:Header>
[b]<NS2:Body xmlns:NS2="http://wisp/trans/">[/b]
<NS3:JKResponse xmlns:NS3="tran">
<Name>Hyd</Name>
<Add>test</Add>
<Details>bait</Details>
</NS3:JKResponse>
</NS2:Body>
</NS1:Envelope>


The Body element needs to be in the SOAP namespace, not the "trans" one.
Back to top
View user's profile Send private message
Android 23
PostPosted: Thu Jun 22, 2017 5:20 am    Post subject: Reply with quote

Apprentice

Joined: 27 Mar 2017
Posts: 38

Quote:
<NS1:Envelope xmlns:NS1="http://schemas.xmlsoap.org/soap/envelope/">
<NS1:Header/>
<NS1:Body>
<NS2:JK xmlns:NS2="http://wisp/trans/">
<Name>Hyd</Name>
<Add>test</Add>
<Details>bait</Details>
</NS2:JK>
</NS1:Body>
</NS1:Envelope>


This is the new message after parsing from Json to SOAP.

Now i got new error on SoapRequest node:

A Web Service request has detected a SOCKET error whilst invoking a web service located at host &1, on port &2, on path &3.
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Thu Jun 22, 2017 5:33 am    Post subject: Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 364
Location: Columbus, OH

You'll have to show the entire exception chain if you want any help from us. What is in your post if very generic and we can provide no guidance based on it.
Back to top
View user's profile Send private message
Android 23
PostPosted: Thu Jun 22, 2017 10:16 pm    Post subject: Reply with quote

Apprentice

Joined: 27 Mar 2017
Posts: 38

Quote:
ExceptionList
RecoverableException
File:CHARACTER:F:\build\S1000_slot1\S1000_P\src\DataFlowEngine\MessageServices\ImbDataFlowNode.cpp
Line:INTEGER:1235
Function:CHARACTER:ImbDataFlowNode::createExceptionList
Type:CHARACTER:ComIbmSOAPRequestNode
Name:CHARACTER:JsonSoap#FCMComposite_1_3
Label:CHARACTER:JsonSoap.SOAP Request
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Node throwing exception
Insert
Type:INTEGER:14
Text:CHARACTER:JsonSoap.SOAP Request
RecoverableException
File:CHARACTER:F:\build\S1000_slot1\S1000_P\src\WebServices\WSLibrary\ImbSOAPRequestNode.cpp
Line:INTEGER:841
Function:CHARACTER:ImbSOAPRequestNode::requestData
Type:CHARACTER:ComIbmSOAPRequestNode
Name:CHARACTER:JsonSoap#FCMComposite_1_3
Label:CHARACTER:JsonSoap.SOAP Request
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:3754
Text:CHARACTER:Error occurred in ImbSOAPRequestHelper::makeSOAPRequest()
Insert
Type:INTEGER:14
Text:CHARACTER:JsonSoap.SOAP Request
RecoverableException
File:CHARACTER:F:\build\S1000_slot1\S1000_P\src\WebServices\WSLibrary\ImbSOAPRequestHelper.cpp
Line:INTEGER:3721
Function:CHARACTER:ImbSOAPRequestHelper::logWebServiceInvocationException
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:3162
Text:CHARACTER:WebService Request Exception
Insert
Type:INTEGER:12
Text:CHARACTER:436f6e74656e742d4c656e6774683a203630350d0a436f6e
74656e742d547970653a20746578742f786d6c3b20636861727365743d757
4662d380d0a486f73743a206c6f63616c686f73743a383939390d0a534f415
0416374696f6e3a2022220d0a436f6e6e656374696f6e3a204b6565702d416
c6976650d0a0d0a
Insert
Type:INTEGER:12

Text:CHARACTER:3c3f786d6c2076657273696f6e3d22312e302220656e636f
64696e673d227574662d38223f3e3c736f6170656e763a456e76656c6f7065
20786d6c6e733a736f6170656e763d22687474703a2f2f736368656d61732e
786d6c736f61702e6f72672f736f61702f656e76656c6f70652f223e3c736f61
70656e763a48656164657220786d6c6e733a7773613d22687474703a2f2f7
777772e77332e6f72672f323030352f30382f61646472657373696e67223e3
c7773613a546f3e687474703a2f2f6c6f63616c686f73743a383939392f6461
73743c2f7773613a546f3e3c7773613a5265706c79546f3e3c7773613a4164
64726573733e687474703a2f2f7777772e77332e6f72672f323030352f3038
2f61646472657373696e672f616e6f6e796d6f75733c2f7773613a416464726
573733e3c2f7773613a5265706c79546f3e3c7773613a4d657373616765494
43e75726e3a757569643a393736423444353638334434313442344645313
439383139383338373335363c2f7773613a4d65737361676549443e3c7773
613a416374696f6e3e687474703a2f2f776973702f7472616e732f4a4b3c2f7
773613a416374696f6e3e3c2f736f6170656e763a4865616465723e3c736f61
70656e763a426f64793e3c4e53313a4a4b20786d6c6e733a4e53313d226874
74703a2f2f776973702f7472616e732f223e3c4e616d653e746573743c2f4e6
16d653e3c4164643e4879643c2f4164643e3c44657461696c733e62616974
3c2f44657461696c733e3c2f4e53313a4a4b3e3c2f736f6170656e763a426f64
793e3c2f736f6170656e763a456e76656c6f70653e
Insert
Type:INTEGER:12
Text:CHARACTER:485454502f312e3120343034204e6f7420466f756e640d0a
5365727665723a204170616368652d436f796f74652f312e310d0a436f6e74
656e742d547970653a20746578742f68746d6c3b636861727365743d75746
62d380d0a436f6e74656e742d4c656e6774683a203233380d0a446174653a
204672692c203233204a756e20323031372030363a31333a303720474d54
0d0a0d0a
Insert
Type:INTEGER:12
Text:CHARACTER:3c68746d6c3e3c686561643e3c7469746c653e49424d204
96e746567726174696f6e20427573206572726f72207265706f72743c2f746
9746c653e3c2f686561643e0d0a3c626f64793e3c68313e485454502053746
174757320343034202d205265736f75726365204e6f7420466f756e643c2f6
8313e0d0a3c703e555249202f6461737420646f6573206e6f74206d6170207
46f20616e79206d65737361676520666c6f7720696e2062726f6b65722052
45513c2f703e0d0a3c68333e49424d20496e746567726174696f6e20427573
2031303030353c2f68333e3c2f626f64793e3c2f68746d6c3e0d0a0d0a
Insert
Type:INTEGER:5
Text:CHARACTER:POST /dast HTTP/1.1

RecoverableException
File:CHARACTER:F:\build\S1000_slot1\S1000_P\src\WebServices\WSLibrary\ImbSOAPRequestHelper.cpp
Line:INTEGER:2338
Function:CHARACTER:ImbSOAPRequestHelper::makeSOAPRequest
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:3691
Text:CHARACTER:SyncRequest HTTP Error returned
Insert
Type:INTEGER:5
Text:CHARACTER:HTTP/1.1 404 Not Found
Insert
Type:INTEGER:5
Text:CHARACTER:http://localhost:8999/dast


This is the exception i got now.please help me
Back to top
View user's profile Send private message
martinb
PostPosted: Fri Jun 23, 2017 12:04 am    Post subject: Reply with quote

Master

Joined: 09 Nov 2006
Posts: 210
Location: UK

You can use
Code:
mqsiexplain <BIP code>


to get details of the errors show in the exception list.

So for your case

BIP3691S: A SOAP request encountered an HTTP error while making an HTTP request. The HTTP request was made to the destination 'insert2'. The HTTP status line that was returned was: 'insert1'.

..and the inserts are
- HTTP/1.1 404 Not Found
- http://localhost:8999/dast

So something is listening on that port - but your url path is wrong
Back to top
View user's profile Send private message
Android 23
PostPosted: Mon Jun 26, 2017 10:06 pm    Post subject: Reply with quote

Apprentice

Joined: 27 Mar 2017
Posts: 38

Quote:
So something is listening on that port - but your url path is wrong


I have fixed the URL. I need to set Mockservice URL in the HTTPRequest node instead of WSDL URL.

Thanks guys for the help.

Regards,
Android 23.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Json to Soap & Soap to Json
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.