cancel
Showing results for 
Search instead for 
Did you mean: 

Problem while calling a Webservice from a Stand alone java program

Former Member
0 Kudos

Hello Everyone,

I am using a java program to call a webservice as follows. For this I have generated the client proxy definition for Stand alone proxy using NWDS.

Now when I call the method of the webservice I am getting the correct result but along with the result I am getting one error and one warning message in the output.

The java code to call the webservice is as follows.

public class ZMATRDESCProxyClient {

public static void main(String[] args) throws Exception {

Z_MATRDESC_WSDService ws = new Z_MATRDESC_WSDServiceImpl();

Z_MATRDESC_WSD port = (Z_MATRDESC_WSD)ws.getLogicalPort("Z_MATRDESC_WSDSoapBinding",Z_MATRDESC_WSD.class);

String res = port.zXiTestGetMatrDesc("ABCD134");

System.out.print(res);

}

}

The result I am getting is :

Warning ! Protocol Implementation [com.sap.engine.services.webservices.jaxrpc.wsdl2java.features.builtin.MessageIdProtocol] could not be loaded (NoClassDefFoundError) !

Error Message is :com/sap/guid/GUIDGeneratorFactory

<b>Material Not Found</b> -


> This is the output of webservice method and it is right.

Can any one please let me know why I am getting the warning and error message and how can I fix this.

Thanks

Abinash

Accepted Solutions (0)

Answers (2)

Answers (2)

prabhu_s2
Active Contributor
0 Kudos

abinash

check if helps you

Former Member
0 Kudos

Hi Abhilash,

I think your Z_MATRDESC_WSDService is an interface and Z_MATRDESC_WSDServiceImpl is the class which implements it.

Your first stmt is:

Z_MATRDESC_WSDService ws = new Z_MATRDESC_WSDServiceImpl();

so why are you creating an interface variable and assigning it to an object of a class. Instead you should use the below stmt:

Z_MATRDESC_WSDServiceImpl ws = new Z_MATRDESC_WSDServiceImpl();

Use the above stmt. Then i think your error may go.

Thanks,

Rajeev Gupta

Former Member
0 Kudos

Hi Rajeev,

Thanks for your response. I have tried your suggestion.

Unfortunately output does not change.

Thanks

Abinash

Former Member
0 Kudos

Hi Abhilash,

Tell me currently in your NWDS project, is there any warning shown in your project. If there is any warning, then what warning is it. If there is no warning, then try one more thing:

as your first stmt use this stmt only:

Z_MATRDESC_WSDService ws;

Dont instantiate ws. just use ws in this way.

Tell what is now the output.

Thanks,

Rajeev Gupta

Former Member
0 Kudos

Hi Rajeev,

The Java project does not have any warning. But the stand alone proxy project has following warnings associated with it.

Warning The import javax.xml.rpc.holders is never used Config1BindingStub.java Demo/src/com/demo/callWS line 4

Warning The import javax.xml.rpc.encoding is never used Config1BindingStub.java Demo/src/com/demo/callWS line 6

Warning The import com.sap.engine.services.webservices.jaxrpc.exceptions.TypeMappingException is never used Config1BindingStub.java Demo/src/com/demo/callWS line 10

Warning The import com.sap.engine.services.webservices.jaxrpc.exceptions.accessors.XmlSerializationResourceAccessor is never used Config1BindingStub.java Demo/src/com/demo/callWS line 11

Warning The import com.sap.exception.BaseRuntimeException is never used Config1BindingStub.java Demo/src/com/demo/callWS line 12

When I tried using the stmt

Z_MATRDESC_WSDService ws;

I got the follwoing error. Variable ws is not intilaized.

When I intilazied the ws variable with null as expected I got null poniter exception.

Thanks

Abinash

Gustavo
Explorer
0 Kudos

Hi Abinash,

I have the same problem. Have you solve that problem?

I am using a java program to call a webservice too. And I have generated the client proxy definition for Stand alone proxy using NWDS. When I call the method of the webservice I am getting the correct result but along with the result I am getting one error and one warning message in the output.

The java code to call the webservice is as follows.

MIDadosPessoaisSyncService service = new MIDadosPessoaisSyncServiceImpl();

MIDadosPessoaisSync port = service.getLogicalPort("MIDadosPessoaisSyncPort");

port._setProperty("javax.xml.rpc.security.auth.username","xpto");

port._setProperty("javax.xml.rpc.security.auth.password","xpto");

String out = port.MIDadosPessoaisSync("xpto", "xpto");

System.out.println(out);

The result I am getting is :

Warning ! Protocol Implementation [com.sap.engine.services.webservices.jaxrpc.wsdl2java.features.builtin.MessageIdProtocol] could not be loaded (NoClassDefFoundError) !

Error Message is :com/sap/guid/GUIDGeneratorFactory

<b>The result of the WS is correct!!!</b>

The Java project does not have any warning. But the stand alone proxy project has following warnings associated with it.

This method has a constructor name MIDadosPessoaisSync.java

The import javax.xml.rpc.holders is never used MIDadosPessoaisSyncBindingStub.java

The import javax.xml.rpc.encoding is never used MIDadosPessoaisSyncBindingStub.java

The constructor BaseRuntimeException(ResourceAccessor, String, Throwable) is deprecated MIDadosPessoaisSyncBindingStub.java

It is very similar with your problem, could you help me?

Thanks

Gustavo Freitas