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 » Calling Webservice Problem (HTTPRequest Node)

Post new topic  Reply to topic
 Calling Webservice Problem (HTTPRequest Node) « View previous topic :: View next topic » 
Author Message
gotiashvili
PostPosted: Wed Apr 02, 2008 6:59 am    Post subject: Calling Webservice Problem (HTTPRequest Node) Reply with quote

Newbie

Joined: 02 Apr 2008
Posts: 8

Hello,
I have webservice written in MS VisualStudio 2005. This webservice has two parameters ReferenceID - int and Description - string. It returns string.

I want to call this webservice from Websphere MessageBroker 6.0.2.
I have a simple MessageFlow:

MQInput1 -> HttpRequest1 -> MQOutPut1

I'm putting next message in a Queue1 witch is assignet to MQInput1:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<TestService xmlns="http://tempuri.org/">
<ReferenceID>123</ReferenceID>
<Description>aaa</Description>
</TestService>
</soap:Body>
</soap:Envelope>

and it does not works.

I have captured soap request message message by SmartSniff and it looks like this:

POST /TestWebService/Service.asmx HTTP/1.1
Content-Length: 436
Content-Type: text/xml; charset=utf-8
Host: 192.168.21.178
SOAPAction: ""
Connection: keep-alive

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<TestService xmlns="http://tempuri.org/">
<ReferenceID>123</ReferenceID>
<Description>aaa</Description>
</TestService>
</soap:Body>
</soap:Envelope>

HTTP/1.1 100 Continue
Server: Microsoft-IIS/5.1
Date: Wed, 02 Apr 2008 14:27:19 GMT
X-Powered-By: ASP.NET

HTTP/1.1 500 Internal Server Error
Server: Microsoft-IIS/5.1
Date: Wed, 02 Apr 2008 14:27:19 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 405

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Server did not recognize the value of HTTP Header SOAPAction: .</faultstring><detail /></soap:Fault></soap:Body></soap:Envelope>

As I understood by default SOAPAction in HttpHeader is empty and it is rejected by server.

Than i've added one Compute node before HttpRequest:

MQInput1 -> Compute1 -> HttpRequest1 -> MQOutPut1

and esql code:

SET OutputRoot = InputRoot;
SET OutputRoot.HTTPRequestHeader.SOAPAction = 'http://tempuri.org/TestService';
SET OutputRoot.XMLNS = InputRoot.XMLNS;


after this Soap request and response looks like this:


POST /TestWebService/Service.asmx HTTP/1.1
Content-Length: 46
SOAPAction: http://tempuri.org/TestService
Content-Type: text/xml; charset=utf-8
Host: 192.168.21.178
Connection: keep-alive

SOAPAction: http://tempuri.org/TestService


HTTP/1.1 100 Continue
Server: Microsoft-IIS/5.1
Date: Wed, 02 Apr 2008 14:47:48 GMT
X-Powered-By: ASP.NET

HTTP/1.1 400 Bad Request
Server: Microsoft-IIS/5.1
Date: Wed, 02 Apr 2008 14:47:48 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Length: 0

SoapRequest dissapared somewhere...

I've tried to resolve this problem with SoapEnvelope node but it doesn't help anyway.

Can anyone tell me what's wrong ??

Thanks in advance.
Back to top
View user's profile Send private message
mrgate
PostPosted: Wed Apr 02, 2008 3:07 pm    Post subject: Re: Calling Webservice Problem (HTTPRequest Node) Reply with quote

Centurion

Joined: 28 Feb 2007
Posts: 141
Location: India

gotiashvili wrote:

SET OutputRoot = InputRoot;
SET OutputRoot.HTTPRequestHeader.SOAPAction = 'http://tempuri.org/TestService';
SET OutputRoot.XMLNS = InputRoot.XMLNS;


Hello Please try this once.

SET OutputRoot.Properties=InputRoot.Properties;
SET OutputRoot.HTTPRequestHeader."CONTENT-TYPE" = 'text/xml; charset=UTF-8';
SET OutputRoot.HTTPRequestHeader."X-Original-HTTP-URL"='http://tempuri.org/TestService';
SET OutputRoot.XMLNS=InputRoot.XMLNS;

_________________
MQSeries terrorist
Back to top
View user's profile Send private message
mgk
PostPosted: Wed Apr 02, 2008 3:15 pm    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Actually the above is wrong for what you are trying to do. You should try the following:

SET OutputRoot.Properties=InputRoot.Properties;
SET OutputRoot.HTTPRequestHeader.SOAPAction='http://tempuri.org/TestService';
SET OutputRoot.XMLNS=InputRoot.XMLNS;
_________________
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
mrgate
PostPosted: Wed Apr 02, 2008 3:23 pm    Post subject: Reply with quote

Centurion

Joined: 28 Feb 2007
Posts: 141
Location: India

mgk wrote:
Actually the above is wrong for what you are trying to do. You should try the following:


what is wrong with above code. when we tried to call an external web service, above code worked successfully.
_________________
MQSeries terrorist
Back to top
View user's profile Send private message
gotiashvili
PostPosted: Wed Apr 02, 2008 11:22 pm    Post subject: Reply with quote

Newbie

Joined: 02 Apr 2008
Posts: 8

mgk wrote:
Actually the above is wrong for what you are trying to do. You should try the following:

SET OutputRoot.Properties=InputRoot.Properties;
SET OutputRoot.HTTPRequestHeader.SOAPAction='http://tempuri.org/TestService';
SET OutputRoot.XMLNS=InputRoot.XMLNS;


I've tried this one and it works.

Thaaaank you for replies.

Back to top
View user's profile Send private message
mgk
PostPosted: Wed Apr 02, 2008 11:58 pm    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

mrgate wrote:
Quote:
what is wrong with above code. when we tried to call an external web service, above code worked successfully


It works for you because it does what you want it to do. It would not work for gotiashvili as it does not do what he need it to do. For example it does not set the SOAPAction header which he clearly needs to be set, and it sets Content-Type for no reason, as it sets it to the default when there is no need.

Need I say more?
_________________
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
marcin.kasinski
PostPosted: Thu Apr 03, 2008 2:05 am    Post subject: Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

Problem is empty line between Connection and SOAPAction headers.

From HTTP specification in request first you have headers, then empty line and after that your data data (SOAP request)

In example above your data is just "SOAPAction: http://tempuri.org/TestService"

I had the same problem.

I dont know why broker sometimes generates this additional empty line when in code you set SOAPAction .

I was strange but solution was to move SET OutputRoot.HTTPRequestHeader.SOAPAction = 'http://tempuri.org/TestService'; to another place of code.

I wanted to raise PRM for this but I couldnt recreate this problem.
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
mgk
PostPosted: Thu Apr 03, 2008 2:25 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Marcin. Your problem happened because you created the HTTPRequestHeader as the last child of root, so it became the body of the message being sent. You must create the tree in the right order, which is

Properties
HTTPRequestHeader (if needed e.g, for SOAPAction)
BODY-OF-MESSAGE (XMLNSC, MRM etc)

The request node will always send the LAST CHILD of root as the BODY of the HTTP request unless you used the advanced options to point it to a different location. Therefore, if you create an HTTPRequestHeader as the lastchild of root accidently you will cause that to be used as the message body.
_________________
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
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Calling Webservice Problem (HTTPRequest Node)
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.