You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by Giovanni Ruggiero <ru...@cefriel.it> on 2001/04/02 12:47:16 UTC

Please Help! ApacheSoap --> .Net WebService

Has anyone solved the problem of invoking
a .Net WebService with an ApacheSoap 2.1 client?

Thank you in advance

Giovanni

---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org


RE: Please Help! ApacheSoap --> .Net WebService

Posted by Shu <sh...@esker.fr>.
I have successfully called a .Net WebService from Apache-SOAP under
following environment:
	Platform: Windows 2000
	HTTP Server: IIS 5.0 for Microsoft SOAP
	Apache-SOAP: Version 2.1 rc1
	Development tool: Visual Studio.NET beta version
	JDK: J2SE 1.3

Both MS.NET C# Web Service and Web Service using MS.NET ATL Server were
tested.

There are 2 special notes:
1. Data Type
MS.NET Web Services specify neither encoding style nor xsi:type for return
values in its Response Envelope.
So, Apache-SOAP Client throws an exception:

No Deserializer found to deserialize a
'http://schemas.xmlsoap.org/soap/envelope/:Parameter' using encoding style
'null'.

Apache-SOAP Client needs to register all necessary type mappings before
making call to server. Example:
    SOAPMappingRegistry smr = new SOAPMappingRegistry();
    ParameterSerializer ps = new ParameterSerializer();
    StringDeserializer sd = new StringDeserializer();

smr.mapTypes(null,RPCConstants.Q_ELEM_PARAMETER,Parameter.class,null,ps);
    smr.mapTypes(null,new QName("","name"),null,null,sd);
    call.setSOAPMappingRegistry(smr);

2. Content Type
Web Service using C# does not understand "text/xml; charset=utf-8" content
type which is used by Apache-SOAP. This causes a Client Fault:

System.Web.Services.Protocols.SoapException: Server found request content
type to be 'text/xml; charset=utf-8', but expected 'text/xml'.

If we change TransportMessage.java to hardcode "text/xml" for content type,
it works fine.


>From your previous mail, I think you use C# Web Service since Web Service
using ATL Server contains automatically namespace like <snp:tagname> in its
response envelope.
To work with C# Web Service, you must add a SoapMethod attribute for your
Web method like:
	[ SoapMethod(Action="urn:AddressService#GetList",
		  RequestNamespace="urn:AddressService",
		  ResponseNamespace="urn:AddressService",
		  ResponseElementName="GetListResponse") ]
Thus, the response envelope will contain a namespace definition like:
	<GetListResponse xmlns="urn:AddressService">
and Apach-SOAP can correctly unmarshall the return value.

Hope this helps

Herve


> -----Message d'origine-----
> De : Giovanni Ruggiero [mailto:ruggiero@cefriel.it]
> Envoyé : lundi 2 avril 2001 12:47
> À : soap-user@xml.apache.org
> Objet : Please Help! ApacheSoap --> .Net WebService
>
>
> Has anyone solved the problem of invoking
> a .Net WebService with an ApacheSoap 2.1 client?
>
> Thank you in advance
>
> Giovanni
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org


RE: Please Help! ApacheSoap --> .Net WebService

Posted by Shu <sh...@esker.fr>.
I have successfully called a .Net WebService from Apache-SOAP under
following environment:
	Platform: Windows 2000
	HTTP Server: IIS 5.0 for Microsoft SOAP
	Apache-SOAP: Version 2.1 rc1
	Development tool: Visual Studio.NET beta version
	JDK: J2SE 1.3

Both MS.NET C# Web Service and Web Service using MS.NET ATL Server were
tested.

There are 2 special notes:
1. Data Type
MS.NET Web Services specify neither encoding style nor xsi:type for return
values in its Response Envelope.
So, Apache-SOAP Client throws an exception:

No Deserializer found to deserialize a
'http://schemas.xmlsoap.org/soap/envelope/:Parameter' using encoding style
'null'.

Apache-SOAP Client needs to register all necessary type mappings before
making call to server. Example:
    SOAPMappingRegistry smr = new SOAPMappingRegistry();
    ParameterSerializer ps = new ParameterSerializer();
    StringDeserializer sd = new StringDeserializer();

smr.mapTypes(null,RPCConstants.Q_ELEM_PARAMETER,Parameter.class,null,ps);
    smr.mapTypes(null,new QName("","name"),null,null,sd);
    call.setSOAPMappingRegistry(smr);

2. Content Type
Web Service using C# does not understand "text/xml; charset=utf-8" content
type which is used by Apache-SOAP. This causes a Client Fault:

System.Web.Services.Protocols.SoapException: Server found request content
type to be 'text/xml; charset=utf-8', but expected 'text/xml'.

If we change TransportMessage.java to hardcode "text/xml" for content type,
it works fine.


>From your previous mail, I think you use C# Web Service since Web Service
using ATL Server contains automatically namespace like <snp:tagname> in its
response envelope.
To work with C# Web Service, you must add a SoapMethod attribute for your
Web method like:
	[ SoapMethod(Action="urn:AddressService#GetList",
		  RequestNamespace="urn:AddressService",
		  ResponseNamespace="urn:AddressService",
		  ResponseElementName="GetListResponse") ]
Thus, the response envelope will contain a namespace definition like:
	<GetListResponse xmlns="urn:AddressService">
and Apach-SOAP can correctly unmarshall the return value.

Hope this helps

Herve


> -----Message d'origine-----
> De : Giovanni Ruggiero [mailto:ruggiero@cefriel.it]
> Envoyé : lundi 2 avril 2001 12:47
> À : soap-user@xml.apache.org
> Objet : Please Help! ApacheSoap --> .Net WebService
>
>
> Has anyone solved the problem of invoking
> a .Net WebService with an ApacheSoap 2.1 client?
>
> Thank you in advance
>
> Giovanni
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org