You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Marc Lefebvre <ml...@akimeka.com> on 2008/02/15 03:57:57 UTC

JAVA2wsdl problems

1) I have been using AXIS2's JAVA2WSDL functionality and all was going well
but had some issues when I tried to use the WSDL it generated into other
programs for use.  It seems that its not generating a "compliant" WSDL. 
When I imported the generated WSDL into XMLSpy just to validate it, it found
a bunch of errors.  Most of the problems there had to do with the MIME parts
not being named correctly.  What has been everyones experience in using the
WSDLs generated into other programs.  Any issues?


2) Another issue which came up was in the matter of dealing with methods
that didnt have any args.

For example, if I had a java method:

int getValue();

The WSDL created an "empty" operation for getValue().   So, when I then used
this WSDL in a program like SoapUI to generate a soap request, the body of
the SOAP message was EMPTY.  The SOAP Header had the SOAPAction of
"getValue" specified, but, it seems that the SOAP body should still have
some indication of the operation being performed.  Why is there no method
signature for a no-arg method call?  How do I get one in using JAVA2WSDL?

I hope this is making sense to someone out there...

Thanks,

Marc

-- 
View this message in context: http://www.nabble.com/JAVA2wsdl-problems-tp15494027p15494027.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: JAVA2wsdl problems

Posted by Marc Lefebvre <ml...@akimeka.com>.


Deepal Jayasinghe wrote:
> 
>>
>> 1) I have been using AXIS2's JAVA2WSDL functionality and all was going
>> well
>> but had some issues when I tried to use the WSDL it generated into other
>> programs for use.  It seems that its not generating a "compliant" WSDL. 
>> When I imported the generated WSDL into XMLSpy just to validate it, it
>> found
>> a bunch of errors. 
> What are they ?
>>  Most of the problems there had to do with the MIME parts
>> not being named correctly.  What has been everyones experience in using
>> the
>> WSDLs generated into other programs.  Any issues?
>>   
> could you please send us your java class so that we can looking to it 
> and fix the issues.
> 
> Ok.  Here are the errors that pop up:
> 

1) I have a class called SOATestLabService, and it has a method called: int
getScalarInteger(), which does nothing but return an integer value from the
service, and setScalarInteger(int i), which sets an integer.  Here is what
is generated in the WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:ns1="http://soatestlab"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:ns0="http://io.java/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
targetNamespace="http://soatestlab">
    <wsdl:types>
        <xs:schema xmlns:ns="http://soatestlab"
attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://soatestlab">
            <xs:element name="getScalarIntegerResult" nillable="true"
type="xs:int"/>
            <xs:element name="scalarInteger" nillable="true" type="xs:int"/>
        </xs:schema>
    </wsdl:types>

    <wsdl:message name="getScalarIntegerRequestMessage"/>
    <wsdl:message name="getScalarIntegerResponseMessage">
        <wsdl:part name="getScalarIntegerResult"
element="ns1:getScalarIntegerResult"/>
    </wsdl:message>

    <wsdl:message name="setScalarIntegerRequestMessage">
        <wsdl:part name="scalarInteger" element="ns1:scalarInteger"/>
    </wsdl:message>

    <wsdl:portType name="SOATestLabServicePortType">
        <wsdl:operation name="getScalarInteger">
            <wsdl:input message="ns1:getScalarIntegerRequestMessage"
wsaw:Action="urn:getScalarInteger"/>
            <wsdl:output message="ns1:getScalarIntegerResponseMessage"
wsaw:Action="urn:getScalarIntegerResponse"/>
        </wsdl:operation>

        <wsdl:operation name="setScalarInteger">
            <wsdl:input message="ns1:setScalarIntegerRequestMessage"
wsaw:Action="urn:setScalarInteger"/>
        </wsdl:operation>

    </wsdl:portType>
    
    <wsdl:binding name="SOATestLabServiceSOAP11Binding"
type="ns1:SOATestLabServicePortType">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>

        <wsdl:operation name="getScalarInteger">
            <soap:operation soapAction="urn:getScalarInteger"
style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>

        <wsdl:operation name="setScalarInteger">
            <soap:operation soapAction="urn:setScalarInteger"
style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
        </wsdl:operation>

    </wsdl:binding>


    <wsdl:binding name="SOATestLabServiceSOAP12Binding"
type="ns1:SOATestLabServicePortType">
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>

        <wsdl:operation name="getScalarInteger">
            <soap12:operation soapAction="urn:getScalarInteger"
style="document"/>
            <wsdl:input>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>

        <wsdl:operation name="setScalarInteger">
            <soap12:operation soapAction="urn:setScalarInteger"
style="document"/>
            <wsdl:input>
                <soap12:body use="literal"/>
            </wsdl:input>
        </wsdl:operation>

    </wsdl:binding>

    <wsdl:binding name="SOATestLabServiceHttpBinding"
type="ns1:SOATestLabServicePortType">
        <http:binding verb="POST"/>

        <wsdl:operation name="getScalarInteger">
            <http:operation location="SOATestLabService/getScalarInteger"/>
            <wsdl:input>
                <mime:content type="text/xml" part="getScalarInteger"/>
            </wsdl:input>
            <wsdl:output>
                <mime:content type="text/xml" part="getScalarInteger"/>
            </wsdl:output>
        </wsdl:operation>

        <wsdl:operation name="setScalarInteger">
            <http:operation location="SOATestLabService/setScalarInteger"/>
            <wsdl:input>
                <mime:content type="text/xml" part="setScalarInteger"/>
            </wsdl:input>
        </wsdl:operation>

    </wsdl:binding>

    <wsdl:service name="SOATestLabService">
        <wsdl:port name="SOATestLabServiceSOAP11port_http"
binding="ns1:SOATestLabServiceSOAP11Binding">
            <soap:address
location="http://soatestlab:8080/axis2/services/SOATestLabService"/>
        </wsdl:port>
        <wsdl:port name="SOATestLabServiceSOAP12port_http"
binding="ns1:SOATestLabServiceSOAP12Binding">
            <soap12:address
location="http://soatestlab:8080/axis2/services/SOATestLabService"/>
        </wsdl:port>
        <wsdl:port name="SOATestLabServiceHttpport"
binding="ns1:SOATestLabServiceHttpBinding">
            <http:address
location="http://soatestlab:8080/axis2/services/SOATestLabService"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>


The problems with the above WSDL are:

ERROR 1) in SOATestLabServiceHttpBinding attribute 'part' in extensibility
element <mime:content> refers to part 'getScalarInteger' on <wsdl:input>
which could not be found in message  
'getScalarIntegerRequestMessage'.

ERROR 2) in SOATestLabServiceSOAP11Binding attribute 'part' in extensibility
element <mime:content> refers to part 'getScalarInteger' on <wsdl:input>
which could not be found in message  
'getScalarIntegerRequestMessage'.

ERROR 3) in SOATestLabServiceSOAP12Bindingattribute 'part' in extensibility
element <mime:content> refers to part 'getScalarInteger' on <wsdl:input>
which could not be found in message  
'getScalarIntegerRequestMessage'.

I think these are due to the fact that the getScalarInteger has no args, so
when I remove this section from each binding in the WSDL they are not noted
as an error anymore.  For example, this changes:

        <wsdl:operation name="getScalarInteger">
            <http:operation location="SOATestLabService/getScalarInteger"/>
            <wsdl:input>
                <mime:content type="text/xml" part="getScalarInteger"/>
            </wsdl:input>
            <wsdl:output>
                <mime:content type="text/xml" part="getScalarInteger"/>
            </wsdl:output>
        </wsdl:operation>


to

        <wsdl:operation name="getScalarInteger">
            <http:operation location="SOATestLabService/getScalarInteger"/>
            <wsdl:input/>
            <wsdl:output>
                <mime:content type="text/xml" part="getScalarInteger"/>
            </wsdl:output>
        </wsdl:operation>



ISSUE #1:  Why is JAVA2WSDL creating INPUT section in the binding for
methods with no args?

======================

ERROR 4) in SOATestLabServiceHttpBinding attribute 'part' in extensibility
element <mime:content> refers to part 'getScalarInteger' on <wsdl:output>
which could not be found in message  
'getScalarIntegerResponseMessage'.

ERROR 5) in SOATestLabServiceSOAP11Binding attribute 'part' in extensibility
element <mime:content> refers to part 'getScalarInteger' on <wsdl:output>
which could not be found in message  
'getScalarIntegerResponseMessage'.

ERROR 6) in SOATestLabServiceSOAP12Bindingattribute 'part' in extensibility
element <mime:content> refers to part 'getScalarInteger' on <wsdl:output>
which could not be found in message  
'getScalarIntegerResponseMessage'.


Im not sure WHY these are wrong, but the correct value for these mime parts
should be: 'getScalarIntegerResult' instead of 'getScalarInteger'.  so, when
I make this change it worked.

For example, this changes:

        <wsdl:operation name="getScalarInteger">
            <http:operation location="SOATestLabService/getScalarInteger"/>
            <wsdl:input/>
            <wsdl:output>
                <mime:content type="text/xml" part="getScalarInteger"/>
            </wsdl:output>
        </wsdl:operation>

to:

        <wsdl:operation name="getScalarInteger">
            <http:operation location="SOATestLabService/getScalarInteger"/>
            <wsdl:input/>
            <wsdl:output>
                <mime:content type="text/xml"
part="getScalarIntegerResult"/>
            </wsdl:output>
        </wsdl:operation>


ISSUE #2:  Why is JAVA2WSDL creating incorrect mime parts in the OUTPUT
section in the binding for methods with no args?

======================


ERROR 7) in SOATestLabServiceHttpBinding attribute 'part' in extensibility
element <mime:content> refers to part 'setScalarInteger' on <wsdl:input>
which could not be found in message  
'setScalarIntegerRequestMessage'.

ERROR 8) in SOATestLabServiceSOAP11Binding attribute 'part' in extensibility
element <mime:content> refers to part 'setScalarInteger' on <wsdl:input>
which could not be found in message  
'setScalarIntegerRequestMessage'.

ERROR 9) in SOATestLabServiceSOAP12Bindingattribute 'part' in extensibility
element <mime:content> refers to part 'setScalarInteger' on <wsdl:input>
which could not be found in message  
'setScalarIntegerRequestMessage'.


This one is very similar to ISSUE #2.  The value for the mime part should
be:  scalarInteger, not setScalarInteger, but this is on a method that HAS
an argument being passed on the set method in the java class.

ISSUE #3:  I believe is related to ISSUE #2.


======================

So, the above errors can be hand corrected but I figured these should
probably be correct in the auto-generation in JAVA2WSDL.



Deepal Jayasinghe wrote:
> 
>> 2) Another issue which came up was in the matter of dealing with methods
>> that didnt have any args.
>>
>> For example, if I had a java method:
>>
>> int getValue();
>>
>> The WSDL created an "empty" operation for getValue().   So, when I then
>> used
>> this WSDL in a program like SoapUI to generate a soap request, the body
>> of
>> the SOAP message was EMPTY.  
> 
> I think that is correct.
> 
>> The SOAP Header had the SOAPAction of
>> "getValue" specified, but, it seems that the SOAP body should still have
>> some indication of the operation being performed.  Why is there no method
>> signature for a no-arg method call?  How do I get one in using JAVA2WSDL?
>>
>> I hope this is making sense to someone out there...
>>
>> Thanks,
>>   
> 


ok, so, now, if we send SOAP over HTTP the SOAPAction in the HTTP header has
the "operation" thats being called, for example, "getScalarInteger" from the
above code sample.  And the SOAP header and SOAP body are all empty.  All
works, good.  

-=NOW=-

Lets send SOAP not using HTTP, lets use something like JMS or another
protocol.   No more HTTP header with the SOAPAction.  All the system gets is
the SOAP message, no HTTP header saying which "operation" to perform on the
SOAP message.

Would it make more sense to have the SOAPAction be part of the SOAP Header,
so that ALL receivers of the SOAP Message, no matter the protocol SOAP is
being sent over have access to what operation is being requested?

Maybe I am setting this up wrong, but we have a case where we are not usigng
HTTP to send the SOAP message.

How do I get around this issue when dealing with non-HTTP systems?

Thanks,

-Marc


PS. Sorry this posting is SOOOO long.  Just alot to cover.

-- 
View this message in context: http://www.nabble.com/JAVA2wsdl-problems-tp15494027p15509030.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: JAVA2wsdl problems

Posted by Deepal Jayasinghe <de...@opensource.lk>.
>
> 1) I have been using AXIS2's JAVA2WSDL functionality and all was going well
> but had some issues when I tried to use the WSDL it generated into other
> programs for use.  It seems that its not generating a "compliant" WSDL. 
> When I imported the generated WSDL into XMLSpy just to validate it, it found
> a bunch of errors. 
What are they ?
>  Most of the problems there had to do with the MIME parts
> not being named correctly.  What has been everyones experience in using the
> WSDLs generated into other programs.  Any issues?
>
>   
could you please send us your java class so that we can looking to it 
and fix the issues.
> 2) Another issue which came up was in the matter of dealing with methods
> that didnt have any args.
>
> For example, if I had a java method:
>
> int getValue();
>
> The WSDL created an "empty" operation for getValue().   So, when I then used
> this WSDL in a program like SoapUI to generate a soap request, the body of
> the SOAP message was EMPTY.  
I think that is correct.
> The SOAP Header had the SOAPAction of
> "getValue" specified, but, it seems that the SOAP body should still have
> some indication of the operation being performed.  Why is there no method
> signature for a no-arg method call?  How do I get one in using JAVA2WSDL?
>
> I hope this is making sense to someone out there...
>
> Thanks,
>   
Thanks
Deepal


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org