cancel
Showing results for 
Search instead for 
Did you mean: 

Problem consuming web service created by ABAP via standalone java client

Former Member
0 Kudos

I'm trying to consume web service created by ABAP in R3 system via standalone java client. I should be getting a string reply after consumed the web service (ZSMS_INBOUND), but so far i received null. I cant find any exception or log to trace the problem. Any help would be appreciated. Is there anything wrong with my client calling the web service?

public void myMethod{

// TODO : Implement

try{

Stub stub = (Stub)new ZSMS_INBOUNDServiceImpl().getLogicalPort();

stub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,"http://mytest:8080/sap/bc/srt/rfc/sap/ZSMS_INBOUND?sap- client=100&wsdl=1.1&mode=sap_wsdl");

inboundService = (ZSMS_INBOUND) stub;

BAPIRET2 str = inboundService.ZSMS_INBOUND(date, message, modemId, smsId, tel, time);

ackDeliveryArray<i> = str.toString();

}catch (Exception e) {

e.printStackTrace();

}

}

Generated following SAP help standalone proxy creation steps.

***files fr SEIs

ZSMS_INBOUND.java (interface)

ZSMS_INBOUNDService.java (interface)

ZSMS_INBOUNDServiceImpl.java

ZSMS_INBOUNDSoapBindingStub.java

***files fr Proxy classes

ZSMS_INBOUND.java

ZSMS_INBOUNDResponse.java

BAPIRET2.java

.... many more files

the wsdl is as below (generated by ABAP):

<?xml version="1.0" encoding="utf-8" ?>

- <wsdl:definitions targetNamespace="urn:sap-com:document:sap:rfc:functions" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:n0="http://www.sap.com/webas/630/soap/features/authentication/" xmlns:sap="http://www.sap.com/webas/630/wsdl/features" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="urn:sap-com:document:sap:rfc:functions" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

- <wsdl:types>

- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:sap-com:document:sap:rfc:functions" targetNamespace="urn:sap-com:document:sap:rfc:functions" elementFormDefault="unqualified" attributeFormDefault="qualified">

- <xsd:simpleType name="char1">

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="1" />

</xsd:restriction>

</xsd:simpleType>

- <xsd:simpleType name="char10">

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="10" />

</xsd:restriction>

</xsd:simpleType>

- <xsd:simpleType name="char17">

+ <xsd:restriction base="xsd:string">

<xsd:maxLength value="17" />

</xsd:restriction>

</xsd:simpleType>

- <xsd:simpleType name="char170">

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="170" />

</xsd:restriction>

</xsd:simpleType>

- <xsd:simpleType name="char20">

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="20" />

</xsd:restriction>

</xsd:simpleType>

- <xsd:simpleType name="char220">

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="220" />

</xsd:restriction>

</xsd:simpleType>

- <xsd:simpleType name="char30">

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="30" />

</xsd:restriction>

</xsd:simpleType>

- <xsd:simpleType name="char32">

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="32" />

</xsd:restriction>

</xsd:simpleType>

- <xsd:simpleType name="char50">

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="50" />

</xsd:restriction>

</xsd:simpleType>

- <xsd:simpleType name="date">

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="10" />

<xsd:pattern value="\d\d\d\d-\d\d-\d\d" />

</xsd:restriction>

</xsd:simpleType>

- <xsd:simpleType name="numeric3">

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="3" />

<xsd:pattern value="\d*" />

</xsd:restriction>

</xsd:simpleType>

- <xsd:simpleType name="numeric6">

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="6" />

<xsd:pattern value="\d*" />

</xsd:restriction>

</xsd:simpleType>

- <xsd:simpleType name="time">

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="8" />

<xsd:pattern value="\d\d:\d\d:\d\d" />

</xsd:restriction>

</xsd:simpleType>

- <xsd:complexType name="BAPIRET2">

- <xsd:sequence>

<xsd:element name="TYPE" type="tns:char1" />

<xsd:element name="ID" type="tns:char20" />

<xsd:element name="NUMBER" type="tns:numeric3" />

<xsd:element name="MESSAGE" type="tns:char220" />

<xsd:element name="LOG_NO" type="tns:char20" />

<xsd:element name="LOG_MSG_NO" type="tns:numeric6" />

<xsd:element name="MESSAGE_V1" type="tns:char50" />

<xsd:element name="MESSAGE_V2" type="tns:char50" />

<xsd:element name="MESSAGE_V3" type="tns:char50" />

<xsd:element name="MESSAGE_V4" type="tns:char50" />

<xsd:element name="PARAMETER" type="tns:char32" />

<xsd:element name="ROW" type="xsd:int" />

<xsd:element name="FIELD" type="tns:char30" />

<xsd:element name="SYSTEM" type="tns:char10" />

</xsd:sequence>

</xsd:complexType>

- <xsd:element name="ZSMS_INBOUND">

- <xsd:complexType>

- <xsd:sequence>

<xsd:element name="DATE" type="tns:date" />

<xsd:element name="MESSAGE" type="tns:char170" />

<xsd:element name="MODEMID" type="tns:char10" />

<xsd:element name="SMSID" type="tns:char17" />

<xsd:element name="TEL" type="tns:char20" />

<xsd:element name="TIME" type="tns:time" />

</xsd:sequence>

</xsd:complexType>

</xsd:element>

- <xsd:element name="ZSMS_INBOUNDResponse">

- <xsd:complexType>

- <xsd:sequence>

<xsd:element name="RETURN" type="tns:BAPIRET2" />

</xsd:sequence>

</xsd:complexType>

</xsd:element>

</xsd:schema>

</wsdl:types>

- <wsdl:message name="ZSMS_INBOUND">

<wsdl:part name="parameters" element="tns:ZSMS_INBOUND" />

</wsdl:message>

- <wsdl:message name="ZSMS_INBOUNDResponse">

<wsdl:part name="parameters" element="tns:ZSMS_INBOUNDResponse" />

</wsdl:message>

- <sap:Feature name="design_0" uri="http://www.sap.com/webas/630/soap/features/authentication/">

- <sap:Property qname="n0:AuthenticationLevel">

<sap:Option value="n0:None" />

</sap:Property>

</sap:Feature>

- <wsdl:portType name="ZSMS_INBOUND">

<sap:useFeature feature="tns:design_0" />

- <wsdl:operation name="ZSMS_INBOUND">

<wsdl:input message="tns:ZSMS_INBOUND" />

<wsdl:output message="tns:ZSMS_INBOUNDResponse" />

</wsdl:operation>

</wsdl:portType>

- <wsdl:binding name="ZSMS_INBOUNDSoapBinding" type="tns:ZSMS_INBOUND">

<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />

- <wsdl:operation name="ZSMS_INBOUND">

<soap:operation soapAction="" />

- <wsdl:input>

<soap:body use="literal" />

</wsdl:input>

- <wsdl:output>

<soap:body use="literal" />

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

- <wsdl:service name="ZSMS_INBOUNDService">

- <wsdl:port name="ZSMS_INBOUNDSoapBinding" binding="tns:ZSMS_INBOUNDSoapBinding">

<soap:address location="http://mytest:8080/sap/bc/srt/rfc/sap/ZSMS_INBOUND?sap-client=100" />

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Urgent help needed!!!

I found this error while trying to deploy ejb deployable web service proxy into j2ee engine, following the SAP help example.

Settings

SDM host : Mytest

SDM port : 50118

URL to deploy : file:/C:/DOCUME1/TEKSIO1.HOC/LOCALS~1/Temp/temp11628MyTestEAR.ear

Result

=> deployment aborted : file:/C:/DOCUME1/TEKSIO1.HOC/LOCALS~1/Temp/temp11628MyTestEAR.ear

Aborted: development component 'MyTestEAR'/'sap.com'/'localhost'/'2006.03.15.22.48.59':

Caught exception during application deployment from SAP J2EE Engine's deploy service:

java.rmi.RemoteException: Cannot deploy application sap.com/MyTestEAR.. Reason: Exception during generation of components of application sap.com/MyTestEAR in container EJBContainer.; nested exception is: com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Exception during generation of components of application sap.com/MyTestEAR in container EJBContainer.

(message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).REMEXC)

Deployment exception : The deployment of at least one item aborted

Former Member
0 Kudos

btw, i followed SAP example to create a deployable proxy to consume web service in bean client as well.

In Server Component JNDI name

/wsclients/proxies/<ProviderName>/<ApplicationName>/<ProxyName>

what is this <providerName> refering to? isnt much eloborate in the example.

Former Member
0 Kudos

Hi,

Add guidgenerator.jar jar file to your Java module.

Regards,

Uma

Former Member
0 Kudos

I'm now able to consume the web service, but with the error as below:

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

BAPIRET2 mappingInfo:

TYPE TYPE false false 11

ID ID false false 11

NUMBER NUMBER false false 11

MESSAGE MESSAGE false false 11

LOG_NO LOG_NO false false 11

LOG_MSG_NO LOG_MSG_NO false false 11

MESSAGE_V1 MESSAGE_V1 false false 11

MESSAGE_V2 MESSAGE_V2 false false 11

MESSAGE_V3 MESSAGE_V3 false false 11

MESSAGE_V4 MESSAGE_V4 false false 11

PARAMETER PARAMETER false false 11

ROW ROW false false 11

FIELD FIELD false false 11

SYSTEM SYSTEM false false 11

My java code is :

public class MyTest {

public static void main(String[] args){

try{

Stub stub = (Stub)new ZSMS_INBOUNDServiceImpl().getLogicalPort();

stub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,"http://mytest:8080/sap/bc/srt/rfc/sap/ZSMS_INBOUND?sap-client=100");

ZSMS_INBOUND inboundService = (ZSMS_INBOUND) stub;

BAPIRET2 str = inboundService.ZSMS_INBOUND(param1,param2,param3,param4,param5,param6);

System.out.println(str.toString());

}catch (Exception e) {

e.printStackTrace();

}

}

}

Former Member
0 Kudos

Actually, the web service can be tested successfully from web service navigator. But my problem now is how to consume it from java proxy. Appreciate if anyone can pinpoint my mistake. Here is also another way to consume, but failed though.

String nameSpaceUri = "urn:sap-com:document:sap:rfc:functions";

String serviceName = "ZSMS_INBOUNDService";

String portName = "ZSMS_INBOUNDSoapBinding";

URL url = new URL("http://mytest:8080/sap/bc/srt/rfc/sap/ZSMS_INBOUND?sap-client=100");

ServiceFactory serviceFactory = ServiceFactory.newInstance();

Service inboundSms = serviceFactory.createService(url,new QName(nameSpaceUri,serviceName));

ZSMS_INBOUND inboundService = (ZSMS_INBOUND)inboundSms.getPort(new QName(nameSpaceUri,portName), ZSMS_INBOUND.class);

BAPIRET2 str = inboundService.ZSMS_INBOUND("param1", "param2", "param3", "param4", "param5", "param6");

Former Member
0 Kudos

Hi,

I guess you have created your web service in R/3 using RPC style and not in Document style.

Try this url in your explorer

http://mytest:8080/sap/bc/srt/rfc/sap/ZSMS_INBOUND

This should open your web service home page and test it by sending request parameters.

Regards,

Uma