开发者

Invoking .Net WebService from Java

开发者 https://www.devze.com 2023-01-10 17:53 出处:网络
I had a .Net webService that returns a custom class, lets call it \"MyClass\", used like this example:

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:

  1. You're missing a schema that defines MyClass
  2. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消