Skip to Content
avatar image
Former Member

Handling VO types from webservice model

Hi,

I have developed a webservice that i want to use in my webdynpro. I created a model for this webservice like it is explained in the Webdynpro/EmailWS Sample.

In my webservice there are two methods that handle with a value object (ex: ReqOrderVO). One method takes this a parameter, the other one returns this VO.

My Question: How do i read/write from/to this VO to get/set my values? Is there an example how to handle the methods serialize/deserialize , save/load, marshall/unmarshall?

Best regards

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Apr 14, 2004 at 11:27 AM

    Hi Stefan,

    You do not really need to handle the serialize /deserialize methods at all. Is there any reason why you need to do that anyhow? If not, it would be "as right as rain" if you deal with getter and setter methods that are generated in the class of your object. The other choice is using Web Dynpro context mapping which we propose to you in a similar way like we have done it within the EmailWS sample.

    Hope that helps!

    Best regards,

    Karin

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 14, 2004 at 01:36 PM

    Hi Karin,

    the webdynpro context does not work for me, because i can´t map for example a boolean value to a context like Request_Order.booleanValue.

    In my context view i have the object from the webservice method i want to execute. This method takes an object of a class named ReqOrderVO, no primitives. I thought, before i can execute this webservice method i need to fill the object ReqOrderVO maybe like this:

    ComplexType_ReqOrderVO req =

    new ComplexType_ReqOrderVO();

    ReqOrderVO vo = new ReqOrderVO();

    --> i don´t know how to fill this vo

    req.setOriginalBean(vo);

    wdContext.currentRequest_WSOrderingSystemControllerFacadeViDocument_checkOrderresponseElement().modelObject().setVo(req);

    try

    { wdContext.currentRequest_WSOrderingSystemControllerFacadeViDocument_checkOrderresponseElement().modelObject().execute();

    }

    catch(Exception e) {

    //TODO:handle exception

    }

    Maybe i am totally wrong, but i need to fill the complexType Object before executing the webservice method.

    The webservice is generated from a SessionBean, that uses this VO too. For the sake of working remote, this class must have been declared SERIALIZABLE.

    Best regards

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 16, 2004 at 07:17 AM

    Hi Stefan,

    Unfortunately, I don't know the structure of your Web Service, so the developer tried to make an educated guess 😉

    WebService:

    - Request Structure: "Request_WS..._checkOrderresponse" (I'll call it Request from now on)

    - Response Structure: "Response_WS..._checkOrderresponse" (I'll call it Response from now on)

    - Request has a relation "Vo" to "ComplexType_ReqOrderVO" (I'll call it VO from now on)

    Context:

    - Node_Request

    - ChildNode_VO

    - ChildNode_Response

    Then your code should look like the following:

    Request req = new Request();

    wdContext.currentRequestElement().bind(req);

    VO vo = new VO();

    --> i don´t know how to fill this vo

    // comment from markus: try the following (just an example):

    vo.setBooleanValue(true);

    req.setVO(vo);

    try

    {

    wdContext.currentRequest_WSOrderingSystemControllerFacadeViDocument_checkOrderresponseElement().modelObject().execute();

    wdContext.nodeResponse().invalidate(); //this is required to update the context!

    }

    catch(Exception e) {

    //TODO:handle exception

    }

    Hope that helps!

    Best regards,

    Karin

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 21, 2004 at 06:44 AM

    Hi Karin,

    your educated guess is right except that my webservice method checkOrderresponse does not have a Response. And

    i would like to assign values to my VO with a setBooleanValue(boolean b), but there are no Methods like this. The only methods i have are:

    class java.lang.String doriginalUri

    class java.lang.String doriginalLocalName

    int _getModelType

    class [Lcom.sap.engine.services.webservices.jaxrpc.encoding.FieldInfo; _getFields

    int _getNumberOfFields

    class [Lcom.sap.engine.services.webservices.jaxrpc.encoding.AttributeInfo; _getAttributes

    int _getNumberOfAttributes

    class java.lang.String toString

    void load

    void load

    void save

    void save

    class [Lcom.sap.engine.services.webservices.jaxrpc.encoding.FieldInfo; _insertFieldInfo

    int _getAttributes

    class java.lang.String serialize

    void serialize

    void serialize

    class java.lang.Object deserialize

    class java.lang.Object deserialize

    class java.lang.Object deserialize

    void marshall

    class java.util.Hashtable _getChildren

    class java.util.ArrayList _getChildNodes

    void unmarshall

    class java.lang.String getMechanismType

    int hashCode

    class java.lang.Class getClass

    void wait

    void wait

    void wait

    boolean equals

    void notify

    void notifyAll

    For this reason i asked how to use the serialize/marshal/save methods here. So at least my procedure was right.

    May this be a generation issue, if there should be getters() and setters(). I am using SAP NetWeaver 2.0.4!

    Best regards

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Stefan,

      by the looks of this, your VO does not have any public fields, that is, on the server side the corresponding type does not contain any fields declared as public memebers or fields made public through public getter and setter method.

      Best Regards,

      André