Interoperating With .NET Web Services
September 25th, 2009
There are use cases where you may want to send a message through HTTP, File, or another transport to a .NET Web Service. Using Mule ESB, it’s fairly straight-forward to accomplish this.
Consider this use case:
- A client sends an XML message (not SOAP) to Mule, which goes through some transformation and gets forwarded to a .NET-based web service using an SSL certificate.
- If the client queries for the WSDL, a specialized component in Mule called WSProxyService returns the WSDL, which is retrieved from the .NET web service.
- To the client, http://localhost:8888/services/myservice exposes a standard web service, and the client doesn’t have to know what this service is implemented by, e.g., whether it’s Axis2, .NET, or CXF.
- In some cases, a SOAP action header may need to be added to the message so that .NET can find the right service on the .NET side.
Here’s how you configure this in the Mule configuration file:
Declaring a secure HTTP connector, endpoint, and transformers:
<endpoint name="WSPROXYHTTP" address="http://localhost:8888/services/myservice" synchronous="true" transformer-refs="MyTransformer" /> <xml:xslt-transformer name="MyTransformer" xsl-file="C:myprojectS2C.xsl"/> <spring:bean name="CWSProxyService" class="org.mule.transport.soap.WSProxyService"> <spring:property name="wsdlFile" value="S2CPassthroughWSDL.wsdl"/> </spring:bean> <https:connector name="MyHttpsConnector" clientSoTimeout="30000"> <https:tls-key-store path="C:myprojectv1etccertsserver.jks" storePassword="ssecret" keyPassword="ssecret"/> </https:connector>
Defining a Mule service:
<service name="MyService"> <inbound> <inbound-endpoint ref="WSPROXYHTTP"/> </inbound> <component> <spring-object bean="CWSProxyService" /> </component> <outbound> <pass-through-router> <cxf:outbound-endpoint address="https://anotherhost:7001/services /ws2.svc?Service=processService" proxy="true" synchronous="true"> </pass-through-router> </outbound> </service>
That’s all there is to it. Happy interop’ing!
Tags: .NET, interoperability, Web Services
October 7th, 2009 at 9:51 am
Thanks for the example. How would we configure this code for NTLM authentication? Most .Net web services are protected by NTLM.
Any ideas?