cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a Client Bean for an SAP-Webservice

Former Member
0 Kudos

Hi,

I have created a web service for an SAP-Bapi with the web service creation wizard of the SAP-System (EC5).

Now I would like to implement a client bean in the NetWeaver Developement Studio for it.

How can I give input parameters for a testmethod? I have created the following test method and the init method. Now I need to fill the array Bapisdstad[] somehow. How can I do this? I need to create Bapisdstad-elements, but I don't know how to do this?

Thank you!

Julia

public Z_SalesorderGetStatus port;

/**

  • Business Method.

*/

public String testCustomerId(int Id) {

// TODO : Implement

try{

Bapisdstat[] bapis = new Bapisdstat[1];

this.port.salesorderGetstatus("hallo",bapis);

String b=" ";

return "hallo"+b;

}

catch(Throwable e){

return "Fehler"+e;

}

}

/**

  • Create Method.

*/

public void ejbCreate() throws CreateException {

try{

// TODO : Implement

InitialContext ic = new InitialContext();

Z_SalesorderGetStatusService s = (Z_SalesorderGetStatusService)ic.lookup ("java:comp/env/Salesorder1Proxy");

Z_SalesorderGetStatus vi = (Z_SalesorderGetStatus)s.getLogicalPort(Z_SalesorderGetStatus.class);

this.port = vi;

}

catch(Throwable e)

{

}

}

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Hello Julia,

Doesn`t it work:

bapis[0] = new Bapisdstat(...);
bapis[0].set....(...);

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hi Maksim,

thank you for your answer.

When I insert something like:

bapis[0] = new Bapisdstat();

bapis[0].setMaterial("wood");

I get the following mistake:

java.rmi.RemoteException: Service call exception; nested exception is: com.sap.engine.services.webservices.jaxrpc.exceptions.XmlMarshalException: XML Serialization Error. Property [DocNumber] of class [com.sap.proxies.types.p1.Bapisdstat] must exist and can not be null. This is required by schema description

Is something wrong with my coding or do I have to do something else? Is there any documentation about this?

Best regards,

Julia

former_member182372
Active Contributor
0 Kudos

But you have to specify DocNumber property too because it is mandatory.

bapis[0].setDocNumber("111222333");

Former Member
0 Kudos

Hi,

thank you. How do I know what is the right docNumber or can I choose any number?

I added all the mandatory dates and numbers and now I get this mistake:

java.rmi.RemoteException: Service call exception; nested exception is: com.sap.engine.services.webservices.jaxrpc.exceptions.XmlMarshalException: XML Serialization Error. Object content does not correspond to Schema restrictions of type [urn:sap-com:document:sap:rfc:functions][char1].

Best regards,

Julia

former_member182372
Active Contributor
0 Kudos

Hello Julia,

Regarding first question:

docNumber is part of BAPI functionality, so I don`t know what is expected by BAPI. Refer documentation for functional module.

Regarding second question:

Type of some property is char1 and most probably you set it to incorrect value (may be something like "11").

Chech your wsdl file, section <wsdl:types>. It describes metadata for used types.

Best regards, Maksim Rashchynski.

Answers (0)