You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by santoshkumar <sk...@yahoo.com> on 2012/06/12 09:21:13 UTC

Migration to CXF: WSDL2Java is not generating method with input parameter

I am migrating wsdl-java code generation from Axis to CXF. Have hit an issue
with following WSDL which does not generate method with input parameters
with CXF.  The same WSDL used with Axis 2 generates the method parameter. 

The given WSDL is: 

<wsdl:definitions xmlns:tns="http://soa.mytest.com/services/master/wsdl"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:ns0="http://soa.mytest.com/services/messages" name="TestManifestPT"
targetNamespace="http://soa.mytest.com/services/master/wsdl" >
    <wsdl:types>
        <xs:schema xmlns:tns="http://soa.mytest.com/services/messages"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://soa.mytest.com/services/messages" version="1.2.0"
elementFormDefault="qualified" attributeFormDefault="unqualified">
            <xs:complexType name="TestManifest">
                <xs:complexContent>
                    <xs:extension base="tns:Notification"/>
                </xs:complexContent>
            </xs:complexType>
            <xs:complexType name="Message" abstract="true">
                <xs:attribute name="version" type="tns:Version"/>
            </xs:complexType>
            <xs:complexType name="Notification">
                <xs:complexContent>
                    <xs:extension base="tns:Message"/>
                </xs:complexContent>
            </xs:complexType>
            <xs:simpleType name="Version">
                <xs:restriction base="xs:string"/>
            </xs:simpleType>
            <xs:element name="TestManifest" type="tns:TestManifest"/>
        </xs:schema>
    </wsdl:types>
    
    <wsdl:message name="TestManifest">
        <wsdl:part name="body" element="ns0:TestManifest"/>
    </wsdl:message>
    <wsdl:portType name="TestManifestPT">
        <wsdl:operation name="TestManifest">
            <wsdl:input message="tns:TestManifest"/>
        </wsdl:operation>       
    </wsdl:portType>
   </wsdl:definitions>



The output it generates is testManifest() with empty parameters. The
expected is to generated with message type parameter.

@WebService(targetNamespace = "http://soa.mytest.com/services/master/wsdl",
name = "TestManifestPT")
@DataBinding(org.apache.cxf.xmlbeans.XmlBeansDataBinding.class)
public interface TestManifestPT {

    @Oneway
    @RequestWrapper(localName = "TestManifest", targetNamespace =
"http://soa.mytest.com/services/messages", className =
"com.mytest.soa.services.messages.TestManifestDocument")
    @WebMethod(operationName = "TestManifest")
    public void testManifest();
}

Axis tool generates testManifest( TestManifestDocument doc)  with
parameters. 
One of the constraint is not to change the WSDL in migration.

Looking for help if there are some arguments or parameters in CXF which can
generate the above method with parameter for above CXF.  Thanks in advance
for sharing your insights. 

/santosh




--
View this message in context: http://cxf.547215.n5.nabble.com/Migration-to-CXF-WSDL2Java-is-not-generating-method-with-input-parameter-tp5709568.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Migration to CXF: WSDL2Java is not generating method with input parameter

Posted by Glen Mazza <gm...@talend.com>.
OK, one way to fix the problem is to use the extraargs parameter below 
if you're using Maven:

<wsdlOptions>
<wsdlOption>
<wsdl>
                                     
${basedir}/src/main/resources/ShoppingService.wsdl
</wsdl>
<extraargs>
<extraarg>-bareMethods=testManifest</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>

Or just -bareMethods=testManifest if your running wsdl-2-java command-line.

If you have many such methods, create a binding file and set 
enableWrapperStyle to true:
https://cwiki.apache.org/CXF20DOC/wsdl-to-java.html#WSDLtoJava-wrapperstyle
will work for all methods.  You can attach the binding file to your 
wsdl-to-java process via the "-b" setting, or here for the Maven 
plugin:  
https://cwiki.apache.org/CXF20DOC/maven-cxf-codegen-plugin-wsdl-to-java.html

HTH,
Glen


On 06/12/2012 06:20 AM, santoshkumar wrote:
> http://cxf.547215.n5.nabble.com/file/n5709575/TestManifest_Concrete.wsdl
> TestManifest_Concrete.wsdl
>
> Even if the concrete part to WSDL ie the service with binding information is
> added, CXF still generates method name with empty parameter.
>
>      @Oneway
>      @RequestWrapper(localName = "TestManifest", targetNamespace =
> "http://soa.mytest.com/test/messages/test1", className =
> "com.mytest.soa.test.messages.test1.TestManifestDocument")
>      @WebMethod(operationName = "TestManifest", action = "TestManifest")
>      public void testManifest();
>
> I hope am not any limitation and there might be parameter/args which can
> create code gen similar to axis for this case.
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Migration-to-CXF-WSDL2Java-is-not-generating-method-with-input-parameter-tp5709568p5709575.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
Glen Mazza
Talend Community Coders
coders.talend.com
blog: www.jroller.com/gmazza


Re: Migration to CXF: WSDL2Java is not generating method with input parameter

Posted by santoshkumar <sk...@yahoo.com>.
http://cxf.547215.n5.nabble.com/file/n5709575/TestManifest_Concrete.wsdl
TestManifest_Concrete.wsdl 

Even if the concrete part to WSDL ie the service with binding information is
added, CXF still generates method name with empty parameter.

    @Oneway
    @RequestWrapper(localName = "TestManifest", targetNamespace =
"http://soa.mytest.com/test/messages/test1", className =
"com.mytest.soa.test.messages.test1.TestManifestDocument")
    @WebMethod(operationName = "TestManifest", action = "TestManifest")
    public void testManifest();

I hope am not any limitation and there might be parameter/args which can
create code gen similar to axis for this case.

--
View this message in context: http://cxf.547215.n5.nabble.com/Migration-to-CXF-WSDL2Java-is-not-generating-method-with-input-parameter-tp5709568p5709575.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Migration to CXF: WSDL2Java is not generating method with input parameter

Posted by Glen Mazza <gm...@talend.com>.
Welcome to CXF.  Metro rejects that WSDL outright because it's missing a 
wsdl:service and wsdl:binding section, the truncated behavior you're 
getting with CXF may also be because you're not using a full WSDL.  
(Using my soap_client_tutorial code here:  
http://www.jroller.com/gmazza/entry/soap_client_tutorial and just 
replacing the WSDL there with yours.)

Metro and CXF follow the JAX-WS specification for how to map a WSDL 
element to service classes; the behavior may be undefined if the WSDL is 
missing required elements.

Glen

On 06/12/2012 03:21 AM, santoshkumar wrote:
> I am migrating wsdl-java code generation from Axis to CXF. Have hit an issue
> with following WSDL which does not generate method with input parameters
> with CXF.  The same WSDL used with Axis 2 generates the method parameter.
>
> The given WSDL is:
>
> <wsdl:definitions xmlns:tns="http://soa.mytest.com/services/master/wsdl"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:ns0="http://soa.mytest.com/services/messages" name="TestManifestPT"
> targetNamespace="http://soa.mytest.com/services/master/wsdl">
>      <wsdl:types>
>          <xs:schema xmlns:tns="http://soa.mytest.com/services/messages"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://soa.mytest.com/services/messages" version="1.2.0"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
>              <xs:complexType name="TestManifest">
>                  <xs:complexContent>
>                      <xs:extension base="tns:Notification"/>
>                  </xs:complexContent>
>              </xs:complexType>
>              <xs:complexType name="Message" abstract="true">
>                  <xs:attribute name="version" type="tns:Version"/>
>              </xs:complexType>
>              <xs:complexType name="Notification">
>                  <xs:complexContent>
>                      <xs:extension base="tns:Message"/>
>                  </xs:complexContent>
>              </xs:complexType>
>              <xs:simpleType name="Version">
>                  <xs:restriction base="xs:string"/>
>              </xs:simpleType>
>              <xs:element name="TestManifest" type="tns:TestManifest"/>
>          </xs:schema>
>      </wsdl:types>
>
>      <wsdl:message name="TestManifest">
>          <wsdl:part name="body" element="ns0:TestManifest"/>
>      </wsdl:message>
>      <wsdl:portType name="TestManifestPT">
>          <wsdl:operation name="TestManifest">
>              <wsdl:input message="tns:TestManifest"/>
>          </wsdl:operation>
>      </wsdl:portType>
>     </wsdl:definitions>
>
>
>
> The output it generates is testManifest() with empty parameters. The
> expected is to generated with message type parameter.
>
> @WebService(targetNamespace = "http://soa.mytest.com/services/master/wsdl",
> name = "TestManifestPT")
> @DataBinding(org.apache.cxf.xmlbeans.XmlBeansDataBinding.class)
> public interface TestManifestPT {
>
>      @Oneway
>      @RequestWrapper(localName = "TestManifest", targetNamespace =
> "http://soa.mytest.com/services/messages", className =
> "com.mytest.soa.services.messages.TestManifestDocument")
>      @WebMethod(operationName = "TestManifest")
>      public void testManifest();
> }
>
> Axis tool generates testManifest( TestManifestDocument doc)  with
> parameters.
> One of the constraint is not to change the WSDL in migration.
>
> Looking for help if there are some arguments or parameters in CXF which can
> generate the above method with parameter for above CXF.  Thanks in advance
> for sharing your insights.
>
> /santosh
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Migration-to-CXF-WSDL2Java-is-not-generating-method-with-input-parameter-tp5709568.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
Glen Mazza
Talend Community Coders
coders.talend.com
blog: www.jroller.com/gmazza


Re: Migration to CXF: WSDL2Java is not generating method with input parameter

Posted by pandeyvic <pr...@gmail.com>.
Hi Glen/Santosh,

I am facing similar issue of getting void methods and no wrapper objects
generated, I am using ant. somehow link
https://cwiki.apache.org/CXF20DOC/wsdl-to-java.html#WSDLtoJava-wrapperstyle
is no more accessible now, looking for workaround, any help in this regard
would be appreciated, thanks in advance 



--
View this message in context: http://cxf.547215.n5.nabble.com/Migration-to-CXF-WSDL2Java-is-not-generating-method-with-input-parameter-tp5709568p5739977.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Migration to CXF: WSDL2Java is not generating method with input parameter

Posted by santoshkumar <sk...@yahoo.com>.
Thanks a lot Glen. It works very nicely!. 
Appreciate your feedback.

/santosh

--
View this message in context: http://cxf.547215.n5.nabble.com/Migration-to-CXF-WSDL2Java-is-not-generating-method-with-input-parameter-tp5709568p5709583.html
Sent from the cxf-user mailing list archive at Nabble.com.