Yes, that soved problem with complex type. Thanks. I will do tests with more
complex data. Hope those tests will be successful.

On Fri, Apr 18, 2008 at 1:24 PM, Dimuthu Gamage <[EMAIL PROTECTED]> wrote:

> Hi alebu,
>
> Are you using axis2/Java 1.3.0 for the WSDL2C tool. If so please try
> again with the Axis2/Java nightly build,
> http://people.apache.org/dist/axis2/nightly
>
>
> Thanks
> Dimuthu
>
>
> On Fri, Apr 18, 2008 at 3:57 PM, alebu <[EMAIL PROTECTED]> wrote:
> > Hi, I am trying to use WSDL2C utility to create stab for my web-service,
> but
> > at this moment can't undersand whats wrong:
> > Code generator works incorrectly or my provided WSDL is wrong in some
> way.
> > In general, when I created very simple web-service which gets and
> returns
> > string from http://www.w3.org/2001/XMLSchema NS
> >  then everything works almost fine. The little problem occurs in
> testing. I
> > am using SoapUI application for testing WS and when I give my WSDL to it
> > ( the same I use to generate WS stabs and skeleton with WSDL2C). So,
> SoapUI
> > wraps body data with WS operation name and WS in this case
> >  cant parse data correctly. I removed operation tag and everything
> worked
> > fine. But it is only in simple cases where primitive types are used,
> > real problems occurs when I am trying to use complex types. WSDL looks
> like:
> >
> > <wsdl:definitions targetNamespace="http://example.com/myws";
> >     xmlns:tns="http://example.com/myws";
> >      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
> >      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
> >     xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
> >      xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
> >
> >     <wsdl:types>
> >         <schema targetNamespace="http://example.com/myws";
> >              xmlns="http://www.w3.org/2001/XMLSchema";>
> >             <complexType name="field_type">
> >                 <sequence>
> >                      <element name="type" type="xsd:string"/>
> >                      <element name="name" type="xsd:string"/>
> >                     <element name="value" type="xsd:string"/>
> >                 </sequence>
> >             </complexType>
> >              <complexType name="serve_req_type">
> >                 <sequence>
> >                     <element name="param" type="tns:field_type"/>
> >                 </sequence>
> >              </complexType>
> >             <complexType name="serve_resp_type">
> >                 <sequence>
> >                     <element name="param" type="xsd:string"/>
> >                  </sequence>
> >             </complexType>
> >         </schema>
> >     </wsdl:types>
> >
> >
> >     <wsdl:message name="serve_req_msg">
> >         <wsdl:part name="value" type="tns:serve_req_type"/>
> >      </wsdl:message>
> >
> >     <wsdl:message name="serve_resp_msg">
> >         <wsdl:part name="value" type="tns:serve_resp_type"/>
> >     </wsdl:message>
> >
> >      <wsdl:portType name="myws_port">
> >         <wsdl:operation name="serve">
> >             <wsdl:input message="tns:serve_req_msg" name="serve_req" />
> >             <wsdl:output message="tns:serve_resp_msg" name="serve_resp"
> />
> >          </wsdl:operation>
> >     </wsdl:portType>
> >
> >     <wsdl:binding name="myws_binding" type="tns:myws_port">
> >         <soap:binding style="rpc"
> > transport="http://schemas.xmlsoap.org/soap/http"/>
> >
> >         <wsdl:operation name="serve">
> >             <soap:operation soapAction="http://example.com/myws/serve"/>
> >              <wsdl:input>
> >                  <soap:body namespace="http://example.com/myws";
> > use="literal"/>
> >             </wsdl:input>
> >             <wsdl:output>
> >                  <soap:body namespace="http://example.com/myws";
> > use="literal"/>
> >              </wsdl:output>
> >         </wsdl:operation>
> >
> >     </wsdl:binding>
> >
> >     <wsdl:service name="myws">
> >         <wsdl:port binding="tns:myws_binding" name="myws_port">
> >              <soap:address
> > location="http://localhost:9090/axis2/services/myws"/>
> >         </wsdl:port>
> >     </wsdl:service>
> >  </wsdl:definitions>
> >
> > for generating code i use command line like:
> > ${AXIS2C_HOME}/bin/WSDL2C.sh -o ${CODE_DST_DIR} -wv 1.1 -l c -ss -sd -f
> -t
> > -ssi -or -uri ${WSDL_FILE}
> >
> > In generated axis2_skel_myws.c file I modified axis2_skel_myws_serve
> > function to inform about what happening
> >  like this:
> >
> > adb_serveResponse_t* axis2_skel_myws_serve(
> >         const axutil_env_t *env,
> >         adb_serve_t* serve
> > ){
> >     printf( "axis2_skel_myws_serve:start\n" );
> >
> >     if( serve == NULL ){
> >          printf( "axis2_skel_myws_serve: serve is NULL\n" );
> >          return NULL;
> >      }
> >
> >      adb_serve_req_type_t* serve_req = adb_serve_get_value( serve, env
> );
> >
> >     if( serve_req == NULL ){
> >         //ERROR!
> >         printf( "axis2_skel_myws_serve: serve_req is NULL\n" );
> >         return NULL;
> >      }
> >
> >     adb_field_type_t* field = adb_serve_req_type_get_param( serve_req,
> env
> > );
> >
> >     if( field == NULL ){
> >         printf( "axis2_skel_myws_serve: field is NULL\n" );
> >         return NULL;
> >      }
> >
> >     printf( "Type is %s\n", adb_field_type_get_type( field, env ));
> >     printf( "Name is %s\n", adb_field_type_get_name( field, env ));
> >     printf( "Value is %s\n", adb_field_type_get_value( field, env ));
> >
> >     // creating response
> >
> >     adb_serve_resp_type_t* resp = adb_serve_resp_type_create( env );
> >     adb_serve_resp_type_set_param( resp, env, "fake response" );
> >
> >     adb_serveResponse_t* rval = adb_serveResponse_create( env );
> >      adb_serveResponse_set_value( rval, env, resp );
> >
> >     return rval;
> > }
> >
> >  And then I loaded WSDL into SoapUI and it formed me test request like
> this:
> > <soapenv:Envelope xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/";
> > xmlns:myws="http://example.com/myws";>
> >     <soapenv:Header/>
> >    <soapenv:Body>
> >          <value>
> >             <param>
> >                <type>string</type>
> >                <name>par1</name>
> >                <value>par1 value</value>
> >              </param>
> >          </value>
> >    </soapenv:Body>
> > </soapenv:Envelope>
> >
> > Request to Axis looks like (SoapUI http log):
> >
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "POST /axis2/services/myws
> > HTTP/1.1[\r][\n]"
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "Content-Type:
> > text/xml;charset=UTF-8[\r][\n]"
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "SOAPAction:
> > "http://example.com/myws/serve"[\r][\n]";
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "User-Agent: Jakarta
> > Commons-HttpClient/3.0.1[\r][
> > \n]"
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "Host: localhost:9090[\r][\n]"
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "Content-Length: 377[\r][\n]"
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "[\r][\n]"
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "<soapenv:Envelope
> > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
> > xmlns:myws="http://example.com/myws";>[\n]"
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "   <soapenv:Header/>[\n]"
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "   <soapenv:Body>[\n]"
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "         <value>[\n]"
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "            <param>[\n]"
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "
> > <type>string</type>[\n]"
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "
> <name>par1</name>[\n]"
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "               <value>par1
> > value</value>[\n]"
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "            </param>[\n]"
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "         </value>[\n]"
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "   </soapenv:Body>[\n]"
> > Sun Mar 23 17:15:53 EET 2008:DEBUG:>> "</soapenv:Envelope>[\n]"
> >
> > From axis console is obvious that adb_serve_get_value returns NULL and
> as I
> > understand it is incorrect behavior.
> > Maybe I did something wrong, can someone catch an eye on my code and
> > probably help with whatever problem it is?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to