You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Shu <sh...@esker.fr> on 2001/04/03 13:31:03 UTC

RE: Java Apache Soap client --> C# MS.NET service

You have 2 ways to solve this problem:

1. Change java code
  Because "result" is a qualified name, you should map "result" with
"http://tempuri.org/" namespace.
  Replace smr.mapTypes (null, new QName("", "result"), null, null, sd);
  by      smr.mapTypes (null, new QName("http://tempuri.org/", "result"),
null, null, sd);

2. Change C# code
  Add XmlElement attribute to your Forse method as below:
    [ XmlElement("result",
Form=System.Xml.Serialization.XmlForm.Unqualified) ]
  This makes "result" as a unqualified name ( the "result" tag will be
<result xmlns=""> )

Herve

> -----Message d'origine-----
> De : Giovanni Ruggiero [mailto:ruggiero@cefriel.it]
> Envoyé : mardi 3 avril 2001 12:33
> À : shu@esker.fr
> Objet : Java Apache Soap client --> C# MS.NET service
>
>
> Dear Shu
> first of all thank you very much for helping me with you answer
> conserning the call of a C# .Net service from a Java Apache Soap
> 2.1 client
>
> thanks to you I've almost fixed all the bugs
> though still not all
>
> Could you please help me to solve this last piece of error
> I'll be very greatfull.
>
> I get the following error:
>
> Exception in thread "main" [SOAPException: faultCode=soap:Client;
> msg=No Deserializer found to deserialize a 'http://tempuri.org/:result'
> using encoding style 'null'.;
> targetException=java.lang.IllegalArgumentException:
> No Deserializer found to deserialize a 'http://tempuri.org/:result' using
> encoding style 'null'.]
>         at org.apache.soap.rpc.Call.invoke(Call.java:244)
>         at Forse.main(Forse.java:55)
>
>
> This is the code fo my client:
>
>     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("", "result"), null, null, sd);
>
>     SOAPHTTPConnection st = new SOAPHTTPConnection();
>
>
>     Call call=new Call();
>
>     call.setSOAPTransport(st);
>     call.setSOAPMappingRegistry(smr);
>     call.setTargetObjectURI("http://tempuri.org/");
>     call.setMethodName("Forse");
>     call.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encoding/");
>
>     Response resp = call.invoke(url,"http://tempuri.org/Forse");
>
>     Parameter ret = resp.getReturnValue();
>
>     Object value=ret.getValue();
>     System.out.println(value);
>
>   }
>
> -------------------------------
>
> Moreover I added the SoapMethod attribute to the C# service
>
> [SoapMethod(Action="http://tempuri.org/Forse",
> 		RequestNamespace="http://tempuri.org/",
> 		RequestElementName="Forse"
> 		ResponseNamespace="http://tempuri.org/",
> 		ResponseElementName="ForseResponse"]
>
>
> I succeded in calling the service and get back the right response
> but not in
> deserializing it.
>
>
> Thank you very much in advance for your help
>
> Bye
>
> Giovanni
>
>
>
>
>
>


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


RE: Java Apache Soap client --> C# MS.NET service

Posted by Shu <sh...@esker.fr>.
Hi Giovanni,

If you want to pass parameters from Apache-SOAP to C# .NET Web Service,
you must apply System.Xml.Serialization.XmlElementAttribute attribute
to your parameters in soap method as below:
 public Rights Authentication(
   [System.Xml.Serialization.XmlElementAttribute(
     Form=System.Xml.Serialization.XmlForm.Unqualified,
     IsNullable=false)] string username,
   [System.Xml.Serialization.XmlElementAttribute(
     Form=System.Xml.Serialization.XmlForm.Unqualified,
     IsNullable=false)] string password)
 {
   ...
 }

And Rights class must be like:
 public class Rights
 {
   [System.Xml.Serialization.XmlElementAttribute("field1",
     Form=System.Xml.Serialization.XmlForm.Unqualified, IsNullable=false)]
   public string Name;
   [System.Xml.Serialization.XmlElementAttribute("field2",
     Form=System.Xml.Serialization.XmlForm.Unqualified, IsNullable=false)]
   public string FirstName;
   ...
 }

Without System.Xml.Serialization.XmlElementAttribute attribute, The Web
Service does not take parameters sent by client. In test mode using
.NET Web Service Page, it works fine because it uses a HTTP GET +
parameters in URL mechanism which is not HTTP SOAP standard.

Herve


> -----Message d'origine-----
> De : Giovanni Ruggiero [mailto:ruggiero@cefriel.it]
> Envoyé : mercredi 11 avril 2001 11:36
> À : shu@esker.fr
> Cc : soap-user@xml.apache.org
> Objet : Java Apache Soap client --> C# MS.NET service
>
>
> Dear Herve
>
> I apoligize for bothering you once again
> but it seems  you're the only one in the soap-user mailing list to have
> tackled the problem of Apache -> .NET soap interoperability.
>
> I wonder if you could give me one more hint for succeding to call a .NET
> service
> method that needs various parameters to be passed.
>
> More particularly: I call a method Authentication of a .NET webservice
> passing "username" and "password" as parameter (I don't bother of security
> problem for the moment)
>
> The service seems not to read the values passed, in fact it return "false"
> as the value of four
> fields of a class "Rights": four children of the <result>
> element, though it
> should not
> (the service works fine when tested in the .NET web service page, and it
> return the proper values).
>
> The comunication seems ok , I don't have any error returned, but I cannot
> either visualize the returned values.
>
> Thank you very much
>
> Best Regards
>
> Giovanni


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


RE: Java Apache Soap client --> C# MS.NET service

Posted by Shu <sh...@esker.fr>.
Hi Giovanni,

If you want to pass parameters from Apache-SOAP to C# .NET Web Service,
you must apply System.Xml.Serialization.XmlElementAttribute attribute
to your parameters in soap method as below:
 public Rights Authentication(
   [System.Xml.Serialization.XmlElementAttribute(
     Form=System.Xml.Serialization.XmlForm.Unqualified,
     IsNullable=false)] string username,
   [System.Xml.Serialization.XmlElementAttribute(
     Form=System.Xml.Serialization.XmlForm.Unqualified,
     IsNullable=false)] string password)
 {
   ...
 }

And Rights class must be like:
 public class Rights
 {
   [System.Xml.Serialization.XmlElementAttribute("field1",
     Form=System.Xml.Serialization.XmlForm.Unqualified, IsNullable=false)]
   public string Name;
   [System.Xml.Serialization.XmlElementAttribute("field2",
     Form=System.Xml.Serialization.XmlForm.Unqualified, IsNullable=false)]
   public string FirstName;
   ...
 }

Without System.Xml.Serialization.XmlElementAttribute attribute, The Web
Service does not take parameters sent by client. In test mode using
.NET Web Service Page, it works fine because it uses a HTTP GET +
parameters in URL mechanism which is not HTTP SOAP standard.

Herve


> -----Message d'origine-----
> De : Giovanni Ruggiero [mailto:ruggiero@cefriel.it]
> Envoyé : mercredi 11 avril 2001 11:36
> À : shu@esker.fr
> Cc : soap-user@xml.apache.org
> Objet : Java Apache Soap client --> C# MS.NET service
>
>
> Dear Herve
>
> I apoligize for bothering you once again
> but it seems  you're the only one in the soap-user mailing list to have
> tackled the problem of Apache -> .NET soap interoperability.
>
> I wonder if you could give me one more hint for succeding to call a .NET
> service
> method that needs various parameters to be passed.
>
> More particularly: I call a method Authentication of a .NET webservice
> passing "username" and "password" as parameter (I don't bother of security
> problem for the moment)
>
> The service seems not to read the values passed, in fact it return "false"
> as the value of four
> fields of a class "Rights": four children of the <result>
> element, though it
> should not
> (the service works fine when tested in the .NET web service page, and it
> return the proper values).
>
> The comunication seems ok , I don't have any error returned, but I cannot
> either visualize the returned values.
>
> Thank you very much
>
> Best Regards
>
> Giovanni


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


Java Apache Soap client --> C# MS.NET service

Posted by Giovanni Ruggiero <ru...@cefriel.it>.
Dear Herve

I apoligize for bothering you once again
but it seems  you're the only one in the soap-user mailing list to have
tackled the problem of Apache -> .NET soap interoperability.

I wonder if you could give me one more hint for succeding to call a .NET
service
method that needs various parameters to be passed.

More particularly: I call a method Authentication of a .NET webservice
passing "username" and "password" as parameter (I don't bother of security
problem for the moment)

The service seems not to read the values passed, in fact it return "false"
as the value of four
fields of a class "Rights": four children of the <result> element, though it
should not
(the service works fine when tested in the .NET web service page, and it
return the proper values).

The comunication seems ok , I don't have any error returned, but I cannot
either visualize the returned values.

Thank you very much

Best Regards

Giovanni


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


Java Apache Soap client --> C# MS.NET service

Posted by Giovanni Ruggiero <ru...@cefriel.it>.
Dear Herve

I apoligize for bothering you once again
but it seems  you're the only one in the soap-user mailing list to have
tackled the problem of Apache -> .NET soap interoperability.

I wonder if you could give me one more hint for succeding to call a .NET
service
method that needs various parameters to be passed.

More particularly: I call a method Authentication of a .NET webservice
passing "username" and "password" as parameter (I don't bother of security
problem for the moment)

The service seems not to read the values passed, in fact it return "false"
as the value of four
fields of a class "Rights": four children of the <result> element, though it
should not
(the service works fine when tested in the .NET web service page, and it
return the proper values).

The comunication seems ok , I don't have any error returned, but I cannot
either visualize the returned values.

Thank you very much

Best Regards

Giovanni


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