You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Suneet Shah <su...@gmail.com> on 2010/11/20 23:37:31 UTC

Calling a .NET Service with CXF client

Hello,

We have a service that was implemented using .NET WCF and I am calling 
it from a client that uses CXF.
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".
How can adjust my client so that it send the right header information?  
The code I am using is pasted 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
Suneet


Re: Calling a .NET Service with CXF client

Posted by Suneet Shah <su...@gmail.com>.
Thanks Dan.

Yes, the content type is correct. I am trying to disable chunking, but 
since we are also using this with Mule, its MuleUniversalConduit is 
adding more complexity.

Thanks
Suneet


Daniel Kulp wrote:
> On Saturday 20 November 2010 5:37:31 pm Suneet Shah wrote:
>   
>> Hello,
>>
>> We have a service that was implemented using .NET WCF and I am calling
>> it from a client that uses CXF.
>> 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".
>>     
>
> Can you use wireshark or similar to capture the raw transfer.   My gut feeling 
> is that it's not sending text/plain.   It's likely .NET's error message is 
> wrong.
>
> Can you follow the docs at:
> http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html
>
> to turn off Chunking and seeing of that helps?  Some versions of .NET have 
> serious issues with Chunking and return strange error messages (or just hang) 
> when chunking is encountered.
>
> Dan
>
>
>
>   
>> How can adjust my client so that it send the right header information?
>> The code I am using is pasted 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
>> Suneet
>>     
>
>   

Re: Calling a .NET Service with CXF client

Posted by Daniel Kulp <dk...@apache.org>.
On Saturday 20 November 2010 5:37:31 pm Suneet Shah wrote:
> Hello,
> 
> We have a service that was implemented using .NET WCF and I am calling
> it from a client that uses CXF.
> 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".

Can you use wireshark or similar to capture the raw transfer.   My gut feeling 
is that it's not sending text/plain.   It's likely .NET's error message is 
wrong.

Can you follow the docs at:
http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html

to turn off Chunking and seeing of that helps?  Some versions of .NET have 
serious issues with Chunking and return strange error messages (or just hang) 
when chunking is encountered.

Dan



> How can adjust my client so that it send the right header information?
> The code I am using is pasted 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
> Suneet

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog