Invoking Web Service via HTTP with basic authentication

Posted by Admin on 29-Dec-2008 22:00

I am trying to invoke a web service using the WS invocation service type. The trick is that the service is expecting credentials supplied via HTTP basic authentication. Is there any way to configure the WS invocation to supply those? (for now I am okay with hardcoding those)

Also, is there a way to configure the WS invocation with arbitrary HTTP headers?

Thanks,

Cornelia

All Replies

Posted by Bill Wood on 30-Dec-2008 09:03

There are two questions here:

a) HTTP Basic Authentication

b) Setting general HTTP Headeres.

Is there any way to configure the WS invocation to supply those ?

ANSWER:

This can be done one of two ways.

Option 1: Adminstratively set in SMC.

-- If you create an outbound routing definition for the URL (e.g. http://abc.com), you can specify a Username and Password for the routing. All HTTP requests will use these for HTTP Basic Authentication.

Option 2: per request in web service invocation step

-- On the Web Service Invocation step, go to the Advanced properties. Set the X-HTTP-AuthUser and X-HTTP-AuthPassword to appropriate values. Note that these values can be substituted from System properties, message headers, etc

Also, is there a way to configure the WS invocation

with arbitrary HTTP headers?

Yes. Any JMS Property added to the message sent to the HTTP destination will be converted to an HTTP header. Again, on the Web Service Invocation step, go to the Advanced properties, and simply add Custom properties

The attached file shows the Web Service Invocation page with settings for Basic Auth, as well as two custom headers. The right side shows a TCP/IP Mon of the HTTP request that reselts. Note the Authorziation: Basic, and the MyHeader1 and MyHeader2

Posted by cwiseman on 01-Dec-2010 06:13

Is the WS Invocation step still available in V8.0?

Does it handle wrapping and unwrapping the SOAP tags around the message content for making the request and receiving the response?

Is there a list of the "X-HTTP-" properties that can be set or over-ridden for using these steps?  I'd like to use this kind of step to make a generic WS invocation where I require making the same web service call to more than one web service provider.  I have knowledge of which URL I ultimately need to request to and I'd like to over-ride that URL at runtime.

Thanks.

Posted by cwiseman on 23-Feb-2011 11:44

Do the Custom header properties allow the variable substitution expressions like the Advanced and Default WSDL Port Address URL allow?  Your attached gif file shows the use of the variable expression on one of the Advanced properties and I've used the expression $[esbmsg:header:WSDL Port Address URL} to override that default property.  I need to dynamically populate some custom header properties that I want the invocation step to pass on as HTTP headers.

I've defined a custom property named 'endpoint'.  The string expression I used is what get's populated as an HTTP header on the receiving end of the WS Invocation Step invocation.  I had hoped that the expression would take the value of the header property referenced.  Is there a way to dynamically override known custom properties?

On the receiving side, it literally just sent the expression as a string when I iterated over the message headers:


    Header:
        name = "endpoint"
        class = "java.lang.String"
        value = "${esbmsg:header:endpoint}

This thread is closed