4 Replies Latest reply on Dec 13, 2010 10:43 AM by Robert (Bob) Brodt

    How to define an object as WS input ?

    Igor JStarter Novice

      Hey!

       

      I want that the input of my WS is an object User with name and number.

      Where can I define this Object? How?

       

      Make a XSD file, import it and insert the targetnamespace:object ?

      Must be sth like that if I can't insert a class into the bpel project ..

       

      Thanks!

        • 1. Re: How to define an object as WS input ?
          Robert (Bob) Brodt Newbie

          Hi Igor,

           

          I'm not quite sure what you are trying to do...are you asking if you can send a POJO to a web service?

          • 2. Re: How to define an object as WS input ?
            Igor JStarter Novice

            I'm trying to specify and complex type, but doesn't work...

             

            WSDLartifacts:

            <?xml version="1.0"?>
            <definitions name="notifyUsersTest"
                    targetNamespace="http://samples/notifyUsersTest"
                    xmlns:tns="http://samples/notifyUsersTest"
                    xmlns:tns2="http://samples/notifyUs"
                    xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
                    xmlns="http://schemas.xmlsoap.org/wsdl/"
                    xmlns:xsd="http://www.w3.org/2001/XMLSchema"        >

             

            <types>
            <xsd:schema>
            <xsd:import namespace="http://samples/notifyUs" xmlns:tns2="http://samples/notifyUs" schemaLocation="notifyUsersTestService.xsd"/>
            </xsd:schema>
            </types>

             

                <message name="notifyUsersTestRequestMessage">
                    <part name="payload" element="tns2:notifyUsersTestRequest"/>
                </message>
                <message name="notifyUsersTestResponseMessage">
                    <part name="payload" element="tns2:notifyUsersTestResponse"/>
                </message>

             

                <!-- portType implemented by the notifyUsersTest BPEL process -->
                <portType name="notifyUsersTest">
                    <operation name="process">
                        <input  message="tns:notifyUsersTestRequestMessage" />
                        <output message="tns:notifyUsersTestResponseMessage"/>
                    </operation>
                </portType>

             

                <plnk:partnerLinkType name="notifyUsersTest">
                    <plnk:role name="notifyUsersTestProvider" portType="tns:notifyUsersTest"/>
                </plnk:partnerLinkType>
               
            </definitions>

             

            XSD:

            <?xml version="1.0" encoding="UTF-8"?>
            <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://samples/notifyUs" xmlns:tns="http://samples/notifyUs" elementFormDefault="qualified">

             

            <xs:element name="notifyUsersTestRequestMessage" type="tns:notifyUsersTestRequest"/>
            <xs:element name="notifyUsersTestResponseMessage" type="tns:notifyUsersTestResponse"/>

             

            <xs:complexType name="notification">
            <xs:sequence>
            <xs:element name="sID" type="xs:string" minOccurs="0"/>
            <xs:element name="iServiceID" type="xs:int" minOccurs="0"/>
            <xs:element name="iTypeID" type="xs:int" minOccurs="0"/>
            <xs:element name="sMedicalStaffPhone" type="xs:string" minOccurs="0"/>
            <xs:element name="sSubscriberPhone" type="xs:string" minOccurs="0"/>
            <xs:element name="bNotifyAll" type="xs:boolean" minOccurs="0"/>
            <xs:element name="calTermin" type="xs:dateTime" minOccurs="0"/>
            </xs:sequence>
            </xs:complexType>

             

            <xs:complexType name="notifyUsersTestRequest">
            <xs:sequence>
            <xs:element name="arg0" type="tns:notification" minOccurs="0"/>
            </xs:sequence>
            </xs:complexType>

             

            <xs:complexType name="notifyUsersTestResponse">
            <xs:sequence>
            <element name="result" type="xs:string"/>
            </xs:sequence>
            </xs:complexType>

             

            </schema>

             

            Any idea ?

            • 3. Re: How to define an object as WS input ?
              Igor JStarter Novice

              Description    Resource    Path    Location    Type
              The part 'payload' has an invalid value 'notifyUsersTestRequest' defined for its element. Element declarations must refer to valid values defined in a schema.    notifyUsersTestArtifacts.wsdl    /notifyUsersTest/bpelContent    line 17    WSDL Problem

              • 4. Re: How to define an object as WS input ?
                Robert (Bob) Brodt Newbie

                There is a problem with your XSD - it should look like this:

                 

                <?xml version="1.0" encoding="UTF-8"?>
                <schema xmlns="http://www.w3.org/2001/XMLSchema"
                    xmlns:xs="http://www.w3.org/2001/XMLSchema"
                    targetNamespace="http://samples/notifyUs"
                    xmlns:tns="http://samples/notifyUs"
                    elementFormDefault="qualified">

                 

                 

                 

                    <xs:element name="notifyUsersTestRequest" type="tns:notifyUsersTestRequestType" />
                    <xs:element name="notifyUsersTestResponse" type="tns:notifyUsersTestResponseType" />

                 

                 

                 

                    <xs:complexType name="notification">
                        <xs:sequence>
                            <xs:element name="sID" type="xs:string" minOccurs="0" />
                            <xs:element name="iServiceID" type="xs:int" minOccurs="0" />
                            <xs:element name="iTypeID" type="xs:int" minOccurs="0" />
                            <xs:element name="sMedicalStaffPhone" type="xs:string"
                                minOccurs="0" />
                            <xs:element name="sSubscriberPhone" type="xs:string"
                                minOccurs="0" />
                            <xs:element name="bNotifyAll" type="xs:boolean" minOccurs="0" />
                            <xs:element name="calTermin" type="xs:dateTime" minOccurs="0" />
                        </xs:sequence>
                    </xs:complexType>

                 

                 

                 

                    <xs:complexType name="notifyUsersTestRequestType">
                        <xs:sequence>
                            <xs:element name="arg0" type="tns:notification" minOccurs="0" />
                        </xs:sequence>
                    </xs:complexType>

                 

                 

                 

                    <xs:complexType name="notifyUsersTestResponseType">
                        <xs:sequence>
                            <element name="result" type="xs:string" />
                        </xs:sequence>
                    </xs:complexType>

                 

                 

                 

                </schema>

                 

                It looks like the notifyUsersTest{Request | Response} elements were not defined (they were called notifyUsersTest{Request|Response}Message instead).