I had a .Net webService that returns a custom class, lets call it "MyClass", used like this example:
[WebMethod]
public MyClass sampleMethod()
{
return new MyClass();
}
If works ok when invoked开发者_Python百科 from a .Net application.
From a Java application using AXIS I am getting the error "MyClass is referenced but not defined".
How can I overcome this issue?
Two things that spring to mind:
- You're missing a schema that defines
MyClass
- A namespace issue surrounding the definition of
MyClass
People will be able to help you further if you can post the WSDL and Schema(s)
First, you have to create a Java proxy: This can be achieved by generating a client by pointing axis to the Web Service WSDL location.
Your Web Service might look like this: http(s)://server:port/path/service_def.asmx
and add ?wsdl
to the end of the wsdl definition (i.e. like this http(s)://server:port/path/service_def.asmx?wsdl
).
From there, generate and client and use the proxy to talk to your .NET Web Service.
PS The possible cause for this is that your class is not defined in a namespace. Check your WSDL definition and see if there's an <xsd:element />
for your class and try adding an ns:
to it and generate java proxy with Axis.
精彩评论