Skip to Content
0
Former Member
Mar 26, 2009 at 08:14 PM

How to consume web service in NWDS CE 7.1?

27 Views

Hi all,

I have a web service defined in XI/PI (process integration), and want to consume it in NWDS CE 7.1. I did some research and there is a sap help http://help.sap.com/saphelp_nwce10/helpdata/en/46/935a636110581de10000000a1553f7/frameset.htm regarding this. However this just does not apply to my case, the corresponding classes referred to in the help just does not exist in my case.

What I did:

1) Import the wsdl into my java project

2) Generate ws client based on the wsdl (Java standalone, not java proxy as EJB)

3) After the client generation, I have four java classes:

a) public interface SI_CounterReading_Out_A extends java.rmi.Remote

b) public class SI_CounterReading_Out_ABindingStub extends org.apache.axis.client.Stub implements SI_CounterReading_Out_A

c) public interface XI_6F873345De7D38C48610E2F078F60406_Service extends javax.xml.rpc.Service

d) public class XI_6F873345De7D38C48610E2F078F60406_ServiceLocator extends org.apache.axis.client.Service implements XI_6F873345De7D38C48610E2F078F60406_Service

4) I crated a java class to call the ws client by using the four classes. However I couldn't get it work.

The code I have:

String endPoint = "http://myendpoint";

SI_CounterReading_Out_ABindingStub stub = new SI_CounterReading_Out_ABindingStub();

stub._setProperty(stub.USERNAME_PROPERTY,"myuser");

stub._setProperty(stub.PASSWORD_PROPERTY, "mypassword");

stub._setProperty(stub.ENDPOINT_ADDRESS_PROPERTY, endPoint);

stub.SI_CounterReading_Out_A(input);

I ran the program, no exception, but apparently the ws was not called.

I also tried the code;

SI_CounterReading_Out_A port = service.getHTTP_Port();

javax.xml.ws.BindingProvider bp = (javax.xml.ws.BindingProvider)port;

Map<String,Object> context = bp.getRequestContext();

context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPoint);

context.put(BindingProvider.USERNAME_PROPERTY,"jxiao");

context.put(BindingProvider.PASSWORD_PROPERTY,"maianji53");

port.SI_CounterReading_Out_A(input);

I got exception taht the class cast javax.xml.ws.BindingProvider bp = (javax.xml.ws.BindingProvider)port;does not work.

Can somebody tell me how to consume the ws in NWDS CE 7.1É