cancel
Showing results for 
Search instead for 
Did you mean: 

Problem consuming a WebService w. generated proxy classes

Former Member
0 Kudos

Hi,

i used the SOAP Proxy Generator for generating my client classes. Now i have a problem with java.lang.Object %{

I get the following Exception:

com.inqmy.lib.schema.SchemaException -> java.lang.ClassCastException: com.mycompany.soap.webshop.java.lang.Object -> java.lang.ClassCastException: com.mycompany.soap.webshop.java.lang.Object

at com.inqmy.lib.schema.generator.ComplexType._unmarshal(ComplexType.java:253)

at com.inqmy.lib.schema.generator.ComplexType.unmarshal(ComplexType.java:313)

at com.inqmy.lib.schema.generator.ComplexType._unmarshal(ComplexType.java:264)

at com.inqmy.lib.schema.generator.ComplexType.unmarshal(ComplexType.java:313)

at com.mycompany.soap.webshop.WebShopSoap.getCustomer(WebShopSoap.java:145)

...

It looks like Object is added to my package name.

Any ideas?

TIA,

Rainer

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks for your reply Nathan,

but the error occurs within the generated classes.

May be this appears familiar to someone here???

Thx rk

Former Member
0 Kudos

Hmm, what is the web service you are trying to consume? Can you post relevant snippets of the WSDL?

Former Member
0 Kudos

Hi Marc,

here's the link to the wsdl:

deleted

Btw, i changed parts of the Exception above. getCustomer == getKunde.

I think the prob has do with these lines in ArrayOfAnyType.java:

private static final java.lang.String[] Cdname =

{ "anyType",};

private static final java.lang.String[] Cdclass = {

/* anyType */ "java.lang.Object",

};

First there stood: "java.lang.Object /unknown/".

After deleting /unknown/ and recompling, it disapeared in the Exception too. Don't know if this is relevant....

Thx rk

Message was edited by: Rainer Kruse

Former Member
0 Kudos

Interesting, I didn't have any problem generating a proxy with this WSDL. Which version of NetWeaver are you using?

However, I will note the ArrayOfAnyType for the response seems odd to me. You're just going to return a wrapper element called getKundeResult with a nillable array of elements named anyType? I think what you are trying to do is return any type you want inside this array, this is not good practice. The whole intent of WSDL is to provide a contract between the client and server, describing I'm going to send you anything I want isn't much of a contract. From my reading of this the element anyType you have defined in this array has no type and you could only return some string content with this element.

What you are thinking of is the type xs:any. This type is meant for extensibility for adding additional elements (also described in schema) that were not known when the original schema was designed, not to arbitrarily return whatever you want. Even though you could do this, a generated proxy would be unlikely to be able to handle what you send this way. You need to descibe it in the WSDL for a generated proxy to handle your responses properly.

The other question I have for you is are you getting this error when you actually invoke this proxy or when you generate it?

Former Member
0 Kudos

Hi Marc,

<i>Which version of NetWeaver are you using?</i>

- none, Internet Sales is delivered with a console-tool to generate the proxy.

<i>The other question I have for you is are you getting this error when you actually invoke this proxy or when you generate it?</i>

- when invoking it.

I didn't write the WebService, i just want to consume it. It was developed by another company, but for same customer. So i could ask the developer to change it.

Excuse my ignorance, do you propose to ask them to change the type "ArrayOfAnyType" to type "any"? And then describe "any" more detailed. As Object[] Array e.g?

TIA

Rainer

Message was edited by: Rainer Kruse

Former Member
0 Kudos

Problem solved,

Thanks Marc,

Rainer

Former Member
0 Kudos

.

Former Member
0 Kudos

I see this error when trying to cast something that I thought was a specific type when in reality it was not. With the object class, I find it useful to do:

myobj.getClass().getName()

to troubleshoot. I always find the results interesting.