[mule-user] Protocol error when call a .NET service

2 views
Skip to first unread message

suneet Shah

unread,
Nov 24, 2010, 12:40:09 PM11/24/10
to us...@mule.codehaus.org
Hello,

We have a service that was implemented using .NET WCF and I am calling it from a client running in Mule 3.

When I call the service, it throws an exception that service is expecting " content header set to text/xml; charset=utf-8 " but my client is sending "text/plain".

Any thoughts on how I can resolve this? The code to call the service is below.

Service service = Service.create(QName.valueOf(connector.getServiceUrl()));
service.addPort(new QName(connector.getServiceNameSpace(),
connector.getServicePort()),
SOAPBinding.SOAP11HTTP_BINDING,
connector.getServiceUrl());

service.getPort(new QName(connector.getServiceNameSpace(),
connector.getServicePort()),
ConnectorService.class);

Thanks

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


David Dossot

unread,
Nov 24, 2010, 12:54:44 PM11/24/10
to us...@mule.codehaus.org
Why don't you use Mule's infrastructure - ie. http://www.mulesoft.org/documentation/display/MULE3USER/Consuming+Web+Services+with+CXF - to call this remote web service?

D.

suneet Shah

unread,
Nov 24, 2010, 1:57:05 PM11/24/10
to us...@mule.codehaus.org
Thanks David.
I will give this a try. The code is left over from when we were solely using cxf .

Suneet

suneet Shah

unread,
Nov 29, 2010, 4:51:16 PM11/29/10
to us...@mule.codehaus.org
Hi,

I am trying to create a client using the example in the link provided, but I am getting the exception below. Any thoughts on what i am doing wrong?

QName SERVICE_NAME = new QName("http://www.openiam.org/service/connector", "ActiveDirectoryConnector");
QName PORT_NAME = new QName("http://www.openiam.org/service/connector", "BasicHttpBinding_ConnectorService");

String endpointAddress = "http://win2003.iamdev.local/ServiceHost/ActiveDirectoryConnector.svc";

Service service = Service.create(SERVICE_NAME);

// Add a port to the Service
service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);

ConnectorService connector = service.getPort(ConnectorService.class);
System.out.println(connector.add(addReqType));

Exception:

org.apache.cxf.interceptor.Fault: Could not send Message.
at org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:48)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:471)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:301)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:253)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:121)
at $Proxy60.add(Unknown Source)
at org.openiam.mule.functional.ServiceClientTest.main(ServiceClientTest.java:41)
Caused by: java.net.MalformedURLException: Invalid address. Endpoint address cannot be null.
at org.apache.cxf.transport.http.HTTPConduit.getURL(HTTPConduit.java:820)
at org.apache.cxf.transport.http.HTTPConduit.getURL(HTTPConduit.java:805)
at org.apache.cxf.transport.http.HTTPConduit.setupURL(HTTPConduit.java:732)
at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:485)
at org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
... 8 more
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Could not send Message.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:141)
at $Proxy60.add(Unknown Source)

Reply all
Reply to author
Forward
0 new messages