Author |
Message
|
er_pankajgupta84 |
Posted: Mon May 18, 2009 4:57 am Post subject: Calling external webservice thru HTTP Request. |
|
|
 Master
Joined: 14 Nov 2008 Posts: 203 Location: charlotte,NC, USA
|
There is a web service hosted on the internet that converts one currency into another..
http://www.webservicex.net/CurrencyConvertor.asmx
I need to create a flow that can send a request to this service and receive a response back.
The input message this service needs is:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<web:ConversionRate xmlns:web="http://www.webserviceX.NET/">
<web:FromCurrency>USD</web:FromCurrency>
<web:ToCurrency>INR</web:ToCurrency>
</web:ConversionRate>
</soapenv:Body>
</soapenv:Envelope>
I am able to invoke this service using a third party web service client like NetTool & SOAPUI. But not from my message broker. I am getting an HTTP/1.1 500 Internal Server Error
I need to use HTTP Request node to invoke this web service.
Here is a brief description on my flow.
I tried 2 flavours:
1. MQInput -> SOAPEnvelope -> HTTP Request -> MQOutput.
2. MQINPUT -> HTTP Request -> MQOutput.
But both of them are not working. HTTP/1.1 500 Internal Server Error
NOTE:
I have set XMLNSC as parser on my MQInput node.
URL to invoke has been hardcoded in HTTPRequest node's properties with all other properties as default.
For 1st flow i have used the following message as input:
<web:ConversionRate>
<web:FromCurrency>INR</web:FromCurrency>
<web:ToCurrency>USD</web:ToCurrency>
</web:ConversionRate>
For Second flow i have used the SOAP message used to invoke the web service directly from NetTool.
Can anybody try this small flow and let me know what i am missing. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon May 18, 2009 5:04 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You need to figure out what the message you are giving to the HTTPRequest looks like.
Then you can figure out how to change it to match what it SHOULD be. |
|
Back to top |
|
 |
er_pankajgupta84 |
Posted: Mon May 18, 2009 5:16 am Post subject: |
|
|
 Master
Joined: 14 Nov 2008 Posts: 203 Location: charlotte,NC, USA
|
Can you please elaborate...on your statement...
This is a web service...and all the clients should send the same kind of message in order to invoke it...
I have already provided the message i used for invoking it using a tool. Now I need to invoke it thru a flow..using HttpRequest node..
I believe "HTTP/1.1 500 Internal Server Error" is not due to message structure...its something because of connectivity as we received this error message on the FAULT terminal of HTTPRequest node.
Is there any kind of property i need to check...while invoking any external webservice using HTTPRequest node?? |
|
Back to top |
|
 |
mqjeff |
Posted: Mon May 18, 2009 5:30 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
No, there is no property. And, no, you do NOT know for sure that you have provided a good message to the HTTPRequest.
The first thing you need to do is understand what the message looks like when it leaves the MQInput node's "out" terminal. Then you need to understand what it looks like just before it goes into the HTTPRequest node's "in" terminal.
Or you could spend a bit more time looking at the error that's produced and seeing what the webservice is complaining about besides just providing HTTP error 500. |
|
Back to top |
|
 |
er_pankajgupta84 |
Posted: Mon May 18, 2009 5:31 am Post subject: |
|
|
 Master
Joined: 14 Nov 2008 Posts: 203 Location: charlotte,NC, USA
|
Just for your information,
I have not set any HTTPRequest Header manually using any Compute/JCN node, it is defualt. Do we need to generate them manually for invoking web services? |
|
Back to top |
|
 |
mqjeff |
Posted: Mon May 18, 2009 5:40 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You need to make sure that the message that is passed to the HTTPRequest node is properly formatted for the options that you have set on the HTTPRequest node, and that it matches what the HTTP service is expecting.
Since you have not mentioned using any compute or Java compute nodes, it was clear that you were not doing anything specific to construct an HTTP header.
However, since you have also failed to specify what version of Message Broker you are using, it is entirely unclear if you need to do this or not. |
|
Back to top |
|
 |
er_pankajgupta84 |
Posted: Mon May 18, 2009 5:58 am Post subject: |
|
|
 Master
Joined: 14 Nov 2008 Posts: 203 Location: charlotte,NC, USA
|
I am using 6.1....
Please note that i am able to invoke the web service using SOAP Request node.
[/img] |
|
Back to top |
|
 |
Vitor |
Posted: Mon May 18, 2009 6:02 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
er_pankajgupta84 wrote: |
Please note that i am able to invoke the web service using SOAP Request node.
|
Which begs the question:
er_pankajgupta84 wrote: |
I need to use HTTP Request node to invoke this web service |
Why?
It also begs the question "what's different about my message?" between using the SOAP Request & SOAP Envelope/HTTP Request again. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
recallsunny |
Posted: Mon May 18, 2009 1:24 pm Post subject: |
|
|
 Disciple
Joined: 15 Jun 2005 Posts: 163 Location: Massachusetts
|
You need to determine the difference between the messages coming out of your HTTPRequest nodes Vs the working version of SOAP request.
An easy way to debug this:
On the NetTool window, there is a tab for "TCP Tunnel" > Click on this and enter the Port number on Local Address to be the same port as target
Example if target is http://www.webservicex.net:7080/CurrencyConvertor.asmx then enter the port as 7080
On the Tunnel To section, enter the Target name/IP and the port of target (7080).
Now in your HTTPRequest node change the URL to point to http://Localhost:7080/CurrencyConvertor.asmx
Start the HTTP tunnel and run a transaction through your flow. The actual request sent out of HTTPRequest node is tunneled through nettool and should now appear in the TCP tunnel window. Compare this with the working version of SOAP message to find out where it differs. |
|
Back to top |
|
 |
|