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 ra...@philips.com on 2001/09/10 07:19:03 UTC
Deserialization problem
Hi,
I am trying to invoke a .Net enabled web service using Java with Apache SOAP toolkit.
I get the following exception:
[SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to deserialize a 'http://localh
ost/:AddResult' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.; targetException=j
ava.lang.IllegalArgumentException: No Deserializer found to deserialize a 'http://localhost/:AddResu
lt' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.]
at org.apache.soap.rpc.Call.invoke(Call.java:246)
at SoapClient1.main(SoapClient1.java:39)
Here's my trial code:
/*
* SoapClient1.java
*
* Created on September 9, 2001, 5:15 PM
*/
// Required due to use of URL class , required by Call class
import java.net.*;
// Required due to use of Vector class
import java.util.*;
// Apache SOAP classes used by client
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;
/**
*
* @author srahul
* @version
*/
public class SoapClient1 {
/** Creates new SoapClient1 */
public SoapClient1() {
}
public static void main(String[] args) {
Call call = new Call();
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
call.setTargetObjectURI("urn:CalcSoap");
call.setMethodName ("Add");
Vector params=new Vector();
params.addElement (new Parameter ("x", String.class, "1", null));
params.addElement(new Parameter ("y", String.class, "2", null));
call.setParams(params);
try {
URL url = new URL ("http://161.85.17.164/calc.asmx");
Response resp = call.invoke(url, "http://localhost/Add");
if (resp.generatedFault()) {
Fault fault=resp.getFault();
System.out.println(" Fault code: " + fault.getFaultCode());
System.out.println(" Fault string: "+fault.getFaultString());
}
Parameter result=resp.getReturnValue();
Object o = result.getValue();
} catch (Exception e) {
e.printStackTrace();
}
}
}
However i am able to iunvoke the service quite easily using c# and the proxy code that
VStudio .Net generates.
Here's the proxy file that is generated by Vstudio.net (if it is of any use...)
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.0.2914.16
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------
namespace GeorgeCalc.WebReference1 {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.Web.Services;
[System.Web.Services.WebServiceBindingAttribute(Name="CalcSoap", Namespace="http://localhost/")]
public class Calc : System.Web.Services.Protocols.SoapHttpClientProtocol {
[System.Diagnostics.DebuggerStepThroughAttribute()]
public Calc() {
this.Url = "http://161.85.17.164/calc.asmx";
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost/Add", RequestNamespace="http://localhost/", ResponseNamespace="http://localhost/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int Add(int x, int y) {
object[] results = this.Invoke("Add", new object[] {
x,
y});
return ((int)(results[0]));
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public System.IAsyncResult BeginAdd(int x, int y, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("Add", new object[] {
x,
y}, callback, asyncState);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public int EndAdd(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
}
}
Can someone please let me know, what i am doing wrong here???
thanks!
==Rahul==
-------------------------------------------
rahul.sawhney@philips.com
Ph: 5579000 Extn: 1029
-------------------------------------------
Re: Deserialization problem
Posted by Minh Kama Yie <mi...@nuix.com.au>.
Hi Rahul,
The problem is the namespace in which the result of the service is defined.
If you map the result using the the SOAPMappingRegistry like so:
{
...
SOAPMappingRegistry smr = new SOAPMappingRegistry();
smr.mapTypes(Constants.NS_URI_SOAP_ENC, new
QName("http://localhost/", "AddResult"), Integer.class, null, new
IntObjectDeserializer());
call.setSOAPMappingRegistry(smr);
...
}
then it should map to the correct encoding type. Currently you're telling the
deserializer to use the "http://schemas.xmlsoap.org/soap/encoding/" namespace
but the service is defining it in the "http://localhost/" namespace. ( see
the c# line with the code {ResponseNamespace="http://localhost/"})
Hope that helps :)
On Monday 10 September 2001 15:19, rahul.sawhney@philips.com wrote:
Hi,
I am trying to invoke a .Net enabled web service using Java with Apache SOAP
toolkit.
I get the following exception:
[SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to
deserialize a 'http://localh ost/:AddResult' using encoding style
'http://schemas.xmlsoap.org/soap/encoding/'.; targetException=j
ava.lang.IllegalArgumentException: No Deserializer found to deserialize a
'http://localhost/:AddResu lt' using encoding style
'http://schemas.xmlsoap.org/soap/encoding/'.] at
org.apache.soap.rpc.Call.invoke(Call.java:246)
at SoapClient1.main(SoapClient1.java:39)
Here's my trial code:
/*
* SoapClient1.java
*
* Created on September 9, 2001, 5:15 PM
*/
// Required due to use of URL class , required by Call class
import java.net.*;
// Required due to use of Vector class
import java.util.*;
// Apache SOAP classes used by client
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;
/**
*
* @author srahul
* @version
*/
public class SoapClient1 {
/** Creates new SoapClient1 */
public SoapClient1() {
}
public static void main(String[] args) {
Call call = new Call();
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
call.setTargetObjectURI("urn:CalcSoap");
call.setMethodName ("Add");
Vector params=new Vector();
params.addElement (new Parameter ("x", String.class, "1", null));
params.addElement(new Parameter ("y", String.class, "2", null));
call.setParams(params);
try {
URL url = new URL ("http://161.85.17.164/calc.asmx");
Response resp = call.invoke(url, "http://localhost/Add");
if (resp.generatedFault()) {
Fault fault=resp.getFault();
System.out.println(" Fault code: " + fault.getFaultCode());
System.out.println(" Fault string: "+fault.getFaultString());
}
Parameter result=resp.getReturnValue();
Object o = result.getValue();
} catch (Exception e) {
e.printStackTrace();
}
}
}
However i am able to iunvoke the service quite easily using c# and the proxy
code that VStudio .Net generates.
Here's the proxy file that is generated by Vstudio.net (if it is of any
use...)
//--------------------------------------------------------------------------
---- // <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.0.2914.16
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
//---------------------------------------------------------------------------
---
namespace GeorgeCalc.WebReference1 {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.Web.Services;
[System.Web.Services.WebServiceBindingAttribute(Name="CalcSoap",
Namespace="http://localhost/")] public class Calc :
System.Web.Services.Protocols.SoapHttpClientProtocol {
[System.Diagnostics.DebuggerStepThroughAttribute()]
public Calc() {
this.Url = "http://161.85.17.164/calc.asmx";
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost
/Add", RequestNamespace="http://localhost/",
ResponseNamespace="http://localhost/",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int Add(int x, int y) {
object[] results = this.Invoke("Add", new object[] {
x,
y});
return ((int)(results[0]));
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public System.IAsyncResult BeginAdd(int x, int y,
System.AsyncCallback callback, object asyncState) { return
this.BeginInvoke("Add", new object[] {
x,
y}, callback, asyncState);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public int EndAdd(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
}
}
Can someone please let me know, what i am doing wrong here???
thanks!
==Rahul==
-------------------------------------------
rahul.sawhney@philips.com
Ph: 5579000 Extn: 1029
-------------------------------------------
--
Regards,
Minh Kama Yie
Nuix
Re: Deserialization problem
Posted by Minh Kama Yie <mi...@nuix.com.au>.
Hi Rahul,
The problem is the namespace in which the result of the service is defined.
If you map the result using the the SOAPMappingRegistry like so:
{
...
SOAPMappingRegistry smr = new SOAPMappingRegistry();
smr.mapTypes(Constants.NS_URI_SOAP_ENC, new
QName("http://localhost/", "AddResult"), Integer.class, null, new
IntObjectDeserializer());
call.setSOAPMappingRegistry(smr);
...
}
then it should map to the correct encoding type. Currently you're telling the
deserializer to use the "http://schemas.xmlsoap.org/soap/encoding/" namespace
but the service is defining it in the "http://localhost/" namespace. ( see
the c# line with the code {ResponseNamespace="http://localhost/"})
Hope that helps :)
On Monday 10 September 2001 15:19, rahul.sawhney@philips.com wrote:
Hi,
I am trying to invoke a .Net enabled web service using Java with Apache SOAP
toolkit.
I get the following exception:
[SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to
deserialize a 'http://localh ost/:AddResult' using encoding style
'http://schemas.xmlsoap.org/soap/encoding/'.; targetException=j
ava.lang.IllegalArgumentException: No Deserializer found to deserialize a
'http://localhost/:AddResu lt' using encoding style
'http://schemas.xmlsoap.org/soap/encoding/'.] at
org.apache.soap.rpc.Call.invoke(Call.java:246)
at SoapClient1.main(SoapClient1.java:39)
Here's my trial code:
/*
* SoapClient1.java
*
* Created on September 9, 2001, 5:15 PM
*/
// Required due to use of URL class , required by Call class
import java.net.*;
// Required due to use of Vector class
import java.util.*;
// Apache SOAP classes used by client
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;
/**
*
* @author srahul
* @version
*/
public class SoapClient1 {
/** Creates new SoapClient1 */
public SoapClient1() {
}
public static void main(String[] args) {
Call call = new Call();
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
call.setTargetObjectURI("urn:CalcSoap");
call.setMethodName ("Add");
Vector params=new Vector();
params.addElement (new Parameter ("x", String.class, "1", null));
params.addElement(new Parameter ("y", String.class, "2", null));
call.setParams(params);
try {
URL url = new URL ("http://161.85.17.164/calc.asmx");
Response resp = call.invoke(url, "http://localhost/Add");
if (resp.generatedFault()) {
Fault fault=resp.getFault();
System.out.println(" Fault code: " + fault.getFaultCode());
System.out.println(" Fault string: "+fault.getFaultString());
}
Parameter result=resp.getReturnValue();
Object o = result.getValue();
} catch (Exception e) {
e.printStackTrace();
}
}
}
However i am able to iunvoke the service quite easily using c# and the proxy
code that VStudio .Net generates.
Here's the proxy file that is generated by Vstudio.net (if it is of any
use...)
//--------------------------------------------------------------------------
---- // <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.0.2914.16
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
//---------------------------------------------------------------------------
---
namespace GeorgeCalc.WebReference1 {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.Web.Services;
[System.Web.Services.WebServiceBindingAttribute(Name="CalcSoap",
Namespace="http://localhost/")] public class Calc :
System.Web.Services.Protocols.SoapHttpClientProtocol {
[System.Diagnostics.DebuggerStepThroughAttribute()]
public Calc() {
this.Url = "http://161.85.17.164/calc.asmx";
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost
/Add", RequestNamespace="http://localhost/",
ResponseNamespace="http://localhost/",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int Add(int x, int y) {
object[] results = this.Invoke("Add", new object[] {
x,
y});
return ((int)(results[0]));
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public System.IAsyncResult BeginAdd(int x, int y,
System.AsyncCallback callback, object asyncState) { return
this.BeginInvoke("Add", new object[] {
x,
y}, callback, asyncState);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public int EndAdd(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
}
}
Can someone please let me know, what i am doing wrong here???
thanks!
==Rahul==
-------------------------------------------
rahul.sawhney@philips.com
Ph: 5579000 Extn: 1029
-------------------------------------------
--
Regards,
Minh Kama Yie
Nuix
RE: Deserialization problem
Posted by Derrick Brundage <br...@digis.net>.
I was able to solve this problem by adding [SoapRpcService()] in front
of the class definition:
[SoapRpcService()]
public class Calc : System.Web.Services.Protocols.SoapHttpClientProtocol
It has something to do with Apache requiring the "literal" encoding
style.
Derrick Brundage
-----Original Message-----
From: rahul.sawhney@philips.com [mailto:rahul.sawhney@philips.com]
Sent: Sunday, September 09, 2001 11:19 PM
To: soap-user@xml.apache.org
Subject: Deserialization problem
Hi,
I am trying to invoke a .Net enabled web service using Java with Apache
SOAP toolkit.
I get the following exception:
[SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to
deserialize a 'http://localh
ost/:AddResult' using encoding style
'http://schemas.xmlsoap.org/soap/encoding/'.; targetException=j
ava.lang.IllegalArgumentException: No Deserializer found to deserialize
a 'http://localhost/:AddResu
lt' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.]
at org.apache.soap.rpc.Call.invoke(Call.java:246)
at SoapClient1.main(SoapClient1.java:39)
Here's my trial code:
/*
* SoapClient1.java
*
* Created on September 9, 2001, 5:15 PM
*/
// Required due to use of URL class , required by Call class
import java.net.*;
// Required due to use of Vector class
import java.util.*;
// Apache SOAP classes used by client
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;
/**
*
* @author srahul
* @version
*/
public class SoapClient1 {
/** Creates new SoapClient1 */
public SoapClient1() {
}
public static void main(String[] args) {
Call call = new Call();
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
call.setTargetObjectURI("urn:CalcSoap");
call.setMethodName ("Add");
Vector params=new Vector();
params.addElement (new Parameter ("x", String.class, "1",
null));
params.addElement(new Parameter ("y", String.class, "2", null));
call.setParams(params);
try {
URL url = new URL ("http://161.85.17.164/calc.asmx");
Response resp = call.invoke(url, "http://localhost/Add");
if (resp.generatedFault()) {
Fault fault=resp.getFault();
System.out.println(" Fault code: " +
fault.getFaultCode());
System.out.println(" Fault string:
"+fault.getFaultString());
}
Parameter result=resp.getReturnValue();
Object o = result.getValue();
} catch (Exception e) {
e.printStackTrace();
}
}
}
However i am able to iunvoke the service quite easily using c# and the
proxy code that
VStudio .Net generates.
Here's the proxy file that is generated by Vstudio.net (if it is of any
use...)
//----------------------------------------------------------------------
--------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.0.2914.16
//
// Changes to this file may cause incorrect behavior and will be
lost if
// the code is regenerated.
// </autogenerated>
//----------------------------------------------------------------------
--------
namespace GeorgeCalc.WebReference1 {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.Web.Services;
[System.Web.Services.WebServiceBindingAttribute(Name="CalcSoap",
Namespace="http://localhost/")]
public class Calc :
System.Web.Services.Protocols.SoapHttpClientProtocol {
[System.Diagnostics.DebuggerStepThroughAttribute()]
public Calc() {
this.Url = "http://161.85.17.164/calc.asmx";
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://local
host/Add", RequestNamespace="http://localhost/",
ResponseNamespace="http://localhost/",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)
]
public int Add(int x, int y) {
object[] results = this.Invoke("Add", new object[] {
x,
y});
return ((int)(results[0]));
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public System.IAsyncResult BeginAdd(int x, int y,
System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("Add", new object[] {
x,
y}, callback, asyncState);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public int EndAdd(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
}
}
Can someone please let me know, what i am doing wrong here???
thanks!
==Rahul==
-------------------------------------------
rahul.sawhney@philips.com
Ph: 5579000 Extn: 1029
-------------------------------------------
Re: Deserialization problem
Posted by Minh Kama Yie <mi...@nuix.com.au>.
beat me to it :)
On Monday 10 September 2001 15:44, you wrote:
You need to tell the call what type "AddResult" is. Have a look at
SOAPMappingRegistry.
cheesr
dim
On Mon, 10 Sep 2001 rahul.sawhney@philips.com wrote:
> Hi,
> I am trying to invoke a .Net enabled web service using Java with Apache
> SOAP toolkit.
>
> I get the following exception:
> [SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to
> deserialize a 'http://localh ost/:AddResult' using encoding style
> 'http://schemas.xmlsoap.org/soap/encoding/'.; targetException=j
> ava.lang.IllegalArgumentException: No Deserializer found to deserialize a
> 'http://localhost/:AddResu lt' using encoding style
> 'http://schemas.xmlsoap.org/soap/encoding/'.] at
> org.apache.soap.rpc.Call.invoke(Call.java:246)
> at SoapClient1.main(SoapClient1.java:39)
>
> Here's my trial code:
> /*
> * SoapClient1.java
> *
> * Created on September 9, 2001, 5:15 PM
> */
> // Required due to use of URL class , required by Call class
> import java.net.*;
>
> // Required due to use of Vector class
> import java.util.*;
>
> // Apache SOAP classes used by client
> import org.apache.soap.util.xml.*;
> import org.apache.soap.*;
> import org.apache.soap.rpc.*;
>
> /**
> *
> * @author srahul
> * @version
> */
> public class SoapClient1 {
>
> /** Creates new SoapClient1 */
> public SoapClient1() {
> }
>
> public static void main(String[] args) {
> Call call = new Call();
> call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
> call.setTargetObjectURI("urn:CalcSoap");
> call.setMethodName ("Add");
> Vector params=new Vector();
> params.addElement (new Parameter ("x", String.class, "1", null));
> params.addElement(new Parameter ("y", String.class, "2", null));
> call.setParams(params);
> try {
> URL url = new URL ("http://161.85.17.164/calc.asmx");
> Response resp = call.invoke(url, "http://localhost/Add");
> if (resp.generatedFault()) {
> Fault fault=resp.getFault();
> System.out.println(" Fault code: " + fault.getFaultCode());
> System.out.println(" Fault string:
> "+fault.getFaultString()); }
> Parameter result=resp.getReturnValue();
> Object o = result.getValue();
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
>
> }
>
>
>
> However i am able to iunvoke the service quite easily using c# and the
> proxy code that VStudio .Net generates.
> Here's the proxy file that is generated by Vstudio.net (if it is of any
> use...)
> //-------------------------------------------------------------------------
>----- // <autogenerated>
> // This code was generated by a tool.
> // Runtime Version: 1.0.2914.16
> //
> // Changes to this file may cause incorrect behavior and will be lost
> if // the code is regenerated.
> // </autogenerated>
> //-------------------------------------------------------------------------
>-----
>
> namespace GeorgeCalc.WebReference1 {
> using System.Diagnostics;
> using System.Xml.Serialization;
> using System;
> using System.Web.Services.Protocols;
> using System.Web.Services;
>
>
> [System.Web.Services.WebServiceBindingAttribute(Name="CalcSoap",
> Namespace="http://localhost/")] public class Calc :
> System.Web.Services.Protocols.SoapHttpClientProtocol {
>
> [System.Diagnostics.DebuggerStepThroughAttribute()]
> public Calc() {
> this.Url = "http://161.85.17.164/calc.asmx";
> }
>
> [System.Diagnostics.DebuggerStepThroughAttribute()]
>
> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhos
>t/Add", RequestNamespace="http://localhost/",
> ResponseNamespace="http://localhost/",
> Use=System.Web.Services.Description.SoapBindingUse.Literal,
> ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
> public int Add(int x, int y) {
> object[] results = this.Invoke("Add", new object[] {
> x,
> y});
> return ((int)(results[0]));
> }
>
> [System.Diagnostics.DebuggerStepThroughAttribute()]
> public System.IAsyncResult BeginAdd(int x, int y,
> System.AsyncCallback callback, object asyncState) { return
> this.BeginInvoke("Add", new object[] {
> x,
> y}, callback, asyncState);
> }
>
> [System.Diagnostics.DebuggerStepThroughAttribute()]
> public int EndAdd(System.IAsyncResult asyncResult) {
> object[] results = this.EndInvoke(asyncResult);
> return ((int)(results[0]));
> }
> }
> }
>
>
> Can someone please let me know, what i am doing wrong here???
>
> thanks!
> ==Rahul==
> -------------------------------------------
> rahul.sawhney@philips.com
> Ph: 5579000 Extn: 1029
> -------------------------------------------
--
Regards,
Minh Kama Yie
Nuix
Re: Deserialization problem
Posted by Minh Kama Yie <mi...@nuix.com.au>.
beat me to it :)
On Monday 10 September 2001 15:44, you wrote:
You need to tell the call what type "AddResult" is. Have a look at
SOAPMappingRegistry.
cheesr
dim
On Mon, 10 Sep 2001 rahul.sawhney@philips.com wrote:
> Hi,
> I am trying to invoke a .Net enabled web service using Java with Apache
> SOAP toolkit.
>
> I get the following exception:
> [SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to
> deserialize a 'http://localh ost/:AddResult' using encoding style
> 'http://schemas.xmlsoap.org/soap/encoding/'.; targetException=j
> ava.lang.IllegalArgumentException: No Deserializer found to deserialize a
> 'http://localhost/:AddResu lt' using encoding style
> 'http://schemas.xmlsoap.org/soap/encoding/'.] at
> org.apache.soap.rpc.Call.invoke(Call.java:246)
> at SoapClient1.main(SoapClient1.java:39)
>
> Here's my trial code:
> /*
> * SoapClient1.java
> *
> * Created on September 9, 2001, 5:15 PM
> */
> // Required due to use of URL class , required by Call class
> import java.net.*;
>
> // Required due to use of Vector class
> import java.util.*;
>
> // Apache SOAP classes used by client
> import org.apache.soap.util.xml.*;
> import org.apache.soap.*;
> import org.apache.soap.rpc.*;
>
> /**
> *
> * @author srahul
> * @version
> */
> public class SoapClient1 {
>
> /** Creates new SoapClient1 */
> public SoapClient1() {
> }
>
> public static void main(String[] args) {
> Call call = new Call();
> call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
> call.setTargetObjectURI("urn:CalcSoap");
> call.setMethodName ("Add");
> Vector params=new Vector();
> params.addElement (new Parameter ("x", String.class, "1", null));
> params.addElement(new Parameter ("y", String.class, "2", null));
> call.setParams(params);
> try {
> URL url = new URL ("http://161.85.17.164/calc.asmx");
> Response resp = call.invoke(url, "http://localhost/Add");
> if (resp.generatedFault()) {
> Fault fault=resp.getFault();
> System.out.println(" Fault code: " + fault.getFaultCode());
> System.out.println(" Fault string:
> "+fault.getFaultString()); }
> Parameter result=resp.getReturnValue();
> Object o = result.getValue();
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
>
> }
>
>
>
> However i am able to iunvoke the service quite easily using c# and the
> proxy code that VStudio .Net generates.
> Here's the proxy file that is generated by Vstudio.net (if it is of any
> use...)
> //-------------------------------------------------------------------------
>----- // <autogenerated>
> // This code was generated by a tool.
> // Runtime Version: 1.0.2914.16
> //
> // Changes to this file may cause incorrect behavior and will be lost
> if // the code is regenerated.
> // </autogenerated>
> //-------------------------------------------------------------------------
>-----
>
> namespace GeorgeCalc.WebReference1 {
> using System.Diagnostics;
> using System.Xml.Serialization;
> using System;
> using System.Web.Services.Protocols;
> using System.Web.Services;
>
>
> [System.Web.Services.WebServiceBindingAttribute(Name="CalcSoap",
> Namespace="http://localhost/")] public class Calc :
> System.Web.Services.Protocols.SoapHttpClientProtocol {
>
> [System.Diagnostics.DebuggerStepThroughAttribute()]
> public Calc() {
> this.Url = "http://161.85.17.164/calc.asmx";
> }
>
> [System.Diagnostics.DebuggerStepThroughAttribute()]
>
> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhos
>t/Add", RequestNamespace="http://localhost/",
> ResponseNamespace="http://localhost/",
> Use=System.Web.Services.Description.SoapBindingUse.Literal,
> ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
> public int Add(int x, int y) {
> object[] results = this.Invoke("Add", new object[] {
> x,
> y});
> return ((int)(results[0]));
> }
>
> [System.Diagnostics.DebuggerStepThroughAttribute()]
> public System.IAsyncResult BeginAdd(int x, int y,
> System.AsyncCallback callback, object asyncState) { return
> this.BeginInvoke("Add", new object[] {
> x,
> y}, callback, asyncState);
> }
>
> [System.Diagnostics.DebuggerStepThroughAttribute()]
> public int EndAdd(System.IAsyncResult asyncResult) {
> object[] results = this.EndInvoke(asyncResult);
> return ((int)(results[0]));
> }
> }
> }
>
>
> Can someone please let me know, what i am doing wrong here???
>
> thanks!
> ==Rahul==
> -------------------------------------------
> rahul.sawhney@philips.com
> Ph: 5579000 Extn: 1029
> -------------------------------------------
--
Regards,
Minh Kama Yie
Nuix
Re: Deserialization problem
Posted by Dmitri Colebatch <di...@bigpond.net.au>.
You need to tell the call what type "AddResult" is. Have a look at
SOAPMappingRegistry.
cheesr
dim
On Mon, 10 Sep 2001 rahul.sawhney@philips.com wrote:
> Hi,
> I am trying to invoke a .Net enabled web service using Java with Apache SOAP toolkit.
>
> I get the following exception:
> [SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to deserialize a 'http://localh
> ost/:AddResult' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.; targetException=j
> ava.lang.IllegalArgumentException: No Deserializer found to deserialize a 'http://localhost/:AddResu
> lt' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.]
> at org.apache.soap.rpc.Call.invoke(Call.java:246)
> at SoapClient1.main(SoapClient1.java:39)
>
> Here's my trial code:
> /*
> * SoapClient1.java
> *
> * Created on September 9, 2001, 5:15 PM
> */
> // Required due to use of URL class , required by Call class
> import java.net.*;
>
> // Required due to use of Vector class
> import java.util.*;
>
> // Apache SOAP classes used by client
> import org.apache.soap.util.xml.*;
> import org.apache.soap.*;
> import org.apache.soap.rpc.*;
>
> /**
> *
> * @author srahul
> * @version
> */
> public class SoapClient1 {
>
> /** Creates new SoapClient1 */
> public SoapClient1() {
> }
>
> public static void main(String[] args) {
> Call call = new Call();
> call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
> call.setTargetObjectURI("urn:CalcSoap");
> call.setMethodName ("Add");
> Vector params=new Vector();
> params.addElement (new Parameter ("x", String.class, "1", null));
> params.addElement(new Parameter ("y", String.class, "2", null));
> call.setParams(params);
> try {
> URL url = new URL ("http://161.85.17.164/calc.asmx");
> Response resp = call.invoke(url, "http://localhost/Add");
> if (resp.generatedFault()) {
> Fault fault=resp.getFault();
> System.out.println(" Fault code: " + fault.getFaultCode());
> System.out.println(" Fault string: "+fault.getFaultString());
> }
> Parameter result=resp.getReturnValue();
> Object o = result.getValue();
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
>
> }
>
>
>
> However i am able to iunvoke the service quite easily using c# and the proxy code that
> VStudio .Net generates.
> Here's the proxy file that is generated by Vstudio.net (if it is of any use...)
> //------------------------------------------------------------------------------
> // <autogenerated>
> // This code was generated by a tool.
> // Runtime Version: 1.0.2914.16
> //
> // Changes to this file may cause incorrect behavior and will be lost if
> // the code is regenerated.
> // </autogenerated>
> //------------------------------------------------------------------------------
>
> namespace GeorgeCalc.WebReference1 {
> using System.Diagnostics;
> using System.Xml.Serialization;
> using System;
> using System.Web.Services.Protocols;
> using System.Web.Services;
>
>
> [System.Web.Services.WebServiceBindingAttribute(Name="CalcSoap", Namespace="http://localhost/")]
> public class Calc : System.Web.Services.Protocols.SoapHttpClientProtocol {
>
> [System.Diagnostics.DebuggerStepThroughAttribute()]
> public Calc() {
> this.Url = "http://161.85.17.164/calc.asmx";
> }
>
> [System.Diagnostics.DebuggerStepThroughAttribute()]
> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost/Add", RequestNamespace="http://localhost/", ResponseNamespace="http://localhost/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
> public int Add(int x, int y) {
> object[] results = this.Invoke("Add", new object[] {
> x,
> y});
> return ((int)(results[0]));
> }
>
> [System.Diagnostics.DebuggerStepThroughAttribute()]
> public System.IAsyncResult BeginAdd(int x, int y, System.AsyncCallback callback, object asyncState) {
> return this.BeginInvoke("Add", new object[] {
> x,
> y}, callback, asyncState);
> }
>
> [System.Diagnostics.DebuggerStepThroughAttribute()]
> public int EndAdd(System.IAsyncResult asyncResult) {
> object[] results = this.EndInvoke(asyncResult);
> return ((int)(results[0]));
> }
> }
> }
>
>
> Can someone please let me know, what i am doing wrong here???
>
> thanks!
> ==Rahul==
> -------------------------------------------
> rahul.sawhney@philips.com
> Ph: 5579000 Extn: 1029
> -------------------------------------------
>
>
>
RE: Deserialization problem
Posted by Derrick Brundage <br...@digis.net>.
I was able to solve this problem by adding [SoapRpcService()] in front
of the class definition:
[SoapRpcService()]
public class Calc : System.Web.Services.Protocols.SoapHttpClientProtocol
It has something to do with Apache requiring the "literal" encoding
style.
Derrick Brundage
-----Original Message-----
From: rahul.sawhney@philips.com [mailto:rahul.sawhney@philips.com]
Sent: Sunday, September 09, 2001 11:19 PM
To: soap-user@xml.apache.org
Subject: Deserialization problem
Hi,
I am trying to invoke a .Net enabled web service using Java with Apache
SOAP toolkit.
I get the following exception:
[SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to
deserialize a 'http://localh
ost/:AddResult' using encoding style
'http://schemas.xmlsoap.org/soap/encoding/'.; targetException=j
ava.lang.IllegalArgumentException: No Deserializer found to deserialize
a 'http://localhost/:AddResu
lt' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.]
at org.apache.soap.rpc.Call.invoke(Call.java:246)
at SoapClient1.main(SoapClient1.java:39)
Here's my trial code:
/*
* SoapClient1.java
*
* Created on September 9, 2001, 5:15 PM
*/
// Required due to use of URL class , required by Call class
import java.net.*;
// Required due to use of Vector class
import java.util.*;
// Apache SOAP classes used by client
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;
/**
*
* @author srahul
* @version
*/
public class SoapClient1 {
/** Creates new SoapClient1 */
public SoapClient1() {
}
public static void main(String[] args) {
Call call = new Call();
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
call.setTargetObjectURI("urn:CalcSoap");
call.setMethodName ("Add");
Vector params=new Vector();
params.addElement (new Parameter ("x", String.class, "1",
null));
params.addElement(new Parameter ("y", String.class, "2", null));
call.setParams(params);
try {
URL url = new URL ("http://161.85.17.164/calc.asmx");
Response resp = call.invoke(url, "http://localhost/Add");
if (resp.generatedFault()) {
Fault fault=resp.getFault();
System.out.println(" Fault code: " +
fault.getFaultCode());
System.out.println(" Fault string:
"+fault.getFaultString());
}
Parameter result=resp.getReturnValue();
Object o = result.getValue();
} catch (Exception e) {
e.printStackTrace();
}
}
}
However i am able to iunvoke the service quite easily using c# and the
proxy code that
VStudio .Net generates.
Here's the proxy file that is generated by Vstudio.net (if it is of any
use...)
//----------------------------------------------------------------------
--------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.0.2914.16
//
// Changes to this file may cause incorrect behavior and will be
lost if
// the code is regenerated.
// </autogenerated>
//----------------------------------------------------------------------
--------
namespace GeorgeCalc.WebReference1 {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.Web.Services;
[System.Web.Services.WebServiceBindingAttribute(Name="CalcSoap",
Namespace="http://localhost/")]
public class Calc :
System.Web.Services.Protocols.SoapHttpClientProtocol {
[System.Diagnostics.DebuggerStepThroughAttribute()]
public Calc() {
this.Url = "http://161.85.17.164/calc.asmx";
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://local
host/Add", RequestNamespace="http://localhost/",
ResponseNamespace="http://localhost/",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)
]
public int Add(int x, int y) {
object[] results = this.Invoke("Add", new object[] {
x,
y});
return ((int)(results[0]));
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public System.IAsyncResult BeginAdd(int x, int y,
System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("Add", new object[] {
x,
y}, callback, asyncState);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public int EndAdd(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
}
}
Can someone please let me know, what i am doing wrong here???
thanks!
==Rahul==
-------------------------------------------
rahul.sawhney@philips.com
Ph: 5579000 Extn: 1029
-------------------------------------------
Re: Deserialization problem
Posted by Dmitri Colebatch <di...@bigpond.net.au>.
You need to tell the call what type "AddResult" is. Have a look at
SOAPMappingRegistry.
cheesr
dim
On Mon, 10 Sep 2001 rahul.sawhney@philips.com wrote:
> Hi,
> I am trying to invoke a .Net enabled web service using Java with Apache SOAP toolkit.
>
> I get the following exception:
> [SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to deserialize a 'http://localh
> ost/:AddResult' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.; targetException=j
> ava.lang.IllegalArgumentException: No Deserializer found to deserialize a 'http://localhost/:AddResu
> lt' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.]
> at org.apache.soap.rpc.Call.invoke(Call.java:246)
> at SoapClient1.main(SoapClient1.java:39)
>
> Here's my trial code:
> /*
> * SoapClient1.java
> *
> * Created on September 9, 2001, 5:15 PM
> */
> // Required due to use of URL class , required by Call class
> import java.net.*;
>
> // Required due to use of Vector class
> import java.util.*;
>
> // Apache SOAP classes used by client
> import org.apache.soap.util.xml.*;
> import org.apache.soap.*;
> import org.apache.soap.rpc.*;
>
> /**
> *
> * @author srahul
> * @version
> */
> public class SoapClient1 {
>
> /** Creates new SoapClient1 */
> public SoapClient1() {
> }
>
> public static void main(String[] args) {
> Call call = new Call();
> call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
> call.setTargetObjectURI("urn:CalcSoap");
> call.setMethodName ("Add");
> Vector params=new Vector();
> params.addElement (new Parameter ("x", String.class, "1", null));
> params.addElement(new Parameter ("y", String.class, "2", null));
> call.setParams(params);
> try {
> URL url = new URL ("http://161.85.17.164/calc.asmx");
> Response resp = call.invoke(url, "http://localhost/Add");
> if (resp.generatedFault()) {
> Fault fault=resp.getFault();
> System.out.println(" Fault code: " + fault.getFaultCode());
> System.out.println(" Fault string: "+fault.getFaultString());
> }
> Parameter result=resp.getReturnValue();
> Object o = result.getValue();
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
>
> }
>
>
>
> However i am able to iunvoke the service quite easily using c# and the proxy code that
> VStudio .Net generates.
> Here's the proxy file that is generated by Vstudio.net (if it is of any use...)
> //------------------------------------------------------------------------------
> // <autogenerated>
> // This code was generated by a tool.
> // Runtime Version: 1.0.2914.16
> //
> // Changes to this file may cause incorrect behavior and will be lost if
> // the code is regenerated.
> // </autogenerated>
> //------------------------------------------------------------------------------
>
> namespace GeorgeCalc.WebReference1 {
> using System.Diagnostics;
> using System.Xml.Serialization;
> using System;
> using System.Web.Services.Protocols;
> using System.Web.Services;
>
>
> [System.Web.Services.WebServiceBindingAttribute(Name="CalcSoap", Namespace="http://localhost/")]
> public class Calc : System.Web.Services.Protocols.SoapHttpClientProtocol {
>
> [System.Diagnostics.DebuggerStepThroughAttribute()]
> public Calc() {
> this.Url = "http://161.85.17.164/calc.asmx";
> }
>
> [System.Diagnostics.DebuggerStepThroughAttribute()]
> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost/Add", RequestNamespace="http://localhost/", ResponseNamespace="http://localhost/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
> public int Add(int x, int y) {
> object[] results = this.Invoke("Add", new object[] {
> x,
> y});
> return ((int)(results[0]));
> }
>
> [System.Diagnostics.DebuggerStepThroughAttribute()]
> public System.IAsyncResult BeginAdd(int x, int y, System.AsyncCallback callback, object asyncState) {
> return this.BeginInvoke("Add", new object[] {
> x,
> y}, callback, asyncState);
> }
>
> [System.Diagnostics.DebuggerStepThroughAttribute()]
> public int EndAdd(System.IAsyncResult asyncResult) {
> object[] results = this.EndInvoke(asyncResult);
> return ((int)(results[0]));
> }
> }
> }
>
>
> Can someone please let me know, what i am doing wrong here???
>
> thanks!
> ==Rahul==
> -------------------------------------------
> rahul.sawhney@philips.com
> Ph: 5579000 Extn: 1029
> -------------------------------------------
>
>
>