Calling WebService in WebMethods from a NET Client with Basic Authentication

Hi,
I have a IS webService exposed to a third party and need to do basic authentication before we accept request. Other party use .Net.

We have created our custom SOAP handler for authentication as desribed in webMethods documentation.

I don’t know .Net, if anyone has any sample of sending authentication information while executing webService from .Net will be very helpful. Need to test if it work with IS. My webService and SOAP processor has given TNPartner ACL.

Thanks
Bibek

You didn’t mention which .Net language was being used to consume your web service.

For C# you would instantiate a NetworkCredential and use it on your web service call. This C# code fragment shows how to create a NetworkCredentials object and add it to a CredentialCache associated with two different URLs (soapEndpoints when you are working with web services).

[highlight=c#]
NetworkCredential myCred = new NetworkCredential(
SecurelyStoredUserName,SecurelyStoredPassword,SecurelyStoredDomain);

CredentialCache myCache = new CredentialCache();

myCache.Add(new Uri(“www.contoso.com”), “Basic”, myCred);
myCache.Add(new Uri(“app.contoso.com”), “Basic”, myCred);

[/highlight]

Once you have created your CredentialCache you need to add it to your web service stub. If your web service stub was called “ws”, the following code would do that:


ws.Credentials = myCred
ws.PreAuthenticate = True

Hi,

We are using VB.NET for this and now we are getting the exception:

We did all the steps for authentication described as in :
SOAP_Developers_Guide_6.5.pdf – Chapter - 7

We gave TNPartner ACL to both to our SOAP processor and service.

But our partner says they get the exception and we also see it in server log as:

[ISS.0088.9134] Exception occurred while processing the body of the message

We change “watt.server.SOAP.enforceMsgPartNS=false” according to some old service request in advantage but no luck. We are using Integration Server V-6.5 in IBM AIX 5.3.

You should see some other error message in the error or server log that indicates what exception is occuring. It could be simply a authentication issue in which case you should see an “access denied” error in the IS server or error log.

It could also be that your authentication is working fine but the Flow service is throwing some type of exception.

Does the service work when you set the ACL for your custom soap processor to Anonymous?

Have you taken the very basic troubleshooting step of capturing the request and reply soap messages using a tool like PocketSoap TCPTrace?

If so, the SOAP response message will contain additional error details in the soap fault element.

Mark

Hi,
The service work fine with Anonymous ACL. Interestingly when I try from our internal network using the VS .Net 2005 it works. But it does not with 2003.

Well, that would seem to point to how the client is calling your service rather than an issue with the ACL or the service itself.

Capture the soap request including the HTTP headers to see what is being sent.

Mark

Hi,
It worked today. The WS client is not working properly and they are not using the new soap rpc processor. This is the reason why it was not working.

Thanks

So, they were using an incorrect URL and not pointing to your custom soap processor?

Does anyone know if wm 7.1 is going to make every service callable from .NET withot creating a wrapper?

Is your question related to the webMethods Microsoft Package or to the original topic of this thread which was calling IS-provided web services from a .Net consumer?

Mark

The latter.

Only yesterday did I figure out that to call a webservice from .NET with Basic HTTP auth i had to create a SOAP processor.

Can you provide more details? Are you using doc/lit or soap/rpc? What .Net language and version? Did you set the pre-authenticate = “true”?

I got it working, by setting up a custom SOAP processor as described in the SOAP Dev guide.

I was using C#, .NET 2.0, soap/rpc. PreAuth = true. All works fine.

My point is that it won’t work out of the box. You must create a special SOAP processor on the IS, for it to work with .NET & Authentication.

Guys,
I am also facing same problem. I tried Mark’s suggestion, but Credentials method is not there for the stub. So not able to do "ws.Credentials = myCred ".

jtu100,
Could you please tell me what to put in the SOAP processor. What logic is required out there.

C# client call works for Anonymous ACL. I am using Visual studio 2008 and webMethods 7.12.

Thanks,
Sid

It’s done. I fgured out the process.
In visual studio 2008, way to add web reference is changed. Add service reference, Click Advance…, click Add web Reference. this will add web reference in the project.

Add following to call a webservice,
Creete stub
ICredentials icred = new NetworkCredential(uerid,password);
obj.Credentials = icred;
Console.WriteLine(stub.method name());
Console.ReadKey();

In webMethods 7.x, wrapper/ Custom SOAP processor is not required to handle authentication from .net based clients.

Thanks,
Sid