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 Kiran Sriram <ki...@hotmail.com> on 2008/02/09 20:14:02 UTC
Axis2 WSDL2Java generated weird method signatures in skeleton
Hello,
I am trying to implement a webservice using WSDL first approach. My requirement is to add method signature which returns a file as an attachment to caller. I am using SWA, wsi:swaRef as type of the return parameter. i have imported the schema for it in my wsdl file. When i generated the server side skeleton using Axis2 WSDL2Java tool, the method signature is generated like this:
public org.ws_i.profiles.basic._1_1.xsd.SwaRef ContentExportAsAttachment ( boolean attachType,java.lang.String lock,java.lang.String traslation )
I dont understand why it is generating the type of the return parameter like this: org.ws_i.profiles.basic._1_1.xsd.SwaRef. This is not even getting compiled now. I thought this should be mapped to "javax.activation.DataHandler" class.
I have used adb binding here.
I am pasting the wsdl file here, it is a simple wsdl with only one method. style i used is document literal.
Any help in this regard is greatly appreciated.
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/TestCommand/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TestCommand" targetNamespace="http://www.example.org/TestCommand/">
<wsdl:types>
<xsd:schema targetNamespace="http://www.example.org/TestCommand/"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" >
<import namespace="http://ws-i.org/profiles/basic/1.1/xsd"
schemaLocation="http://ws-i.org/profiles/basic/1.1/swaref.xsd"/>
<xsd:element name="ContentExportAsAttachment">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="attachType" type="xsd:boolean" />
<xsd:element name="Lock" type="xsd:string"></xsd:element>
<xsd:element name="Traslation" type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ContentExportAsAttachmentResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="return" type="wsi:swaRef"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="ContentExportAsAttachmentRequest">
<wsdl:part element="tns:ContentExportAsAttachment" name="parameters"/>
</wsdl:message>
<wsdl:message name="ContentExportAsAttachmentResponse">
<wsdl:part element="tns:ContentExportAsAttachmentResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="TestCommand">
<wsdl:operation name="ContentExportAsAttachment">
<wsdl:input message="tns:ContentExportAsAttachmentRequest"/>
<wsdl:output message="tns:ContentExportAsAttachmentResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TestCommandSOAP" type="tns:TestCommand">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="ContentExportAsAttachment">
<soap:operation soapAction="http://www.example.org/TestCommand/NewOperation"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TestCommand">
<wsdl:port binding="tns:TestCommandSOAP" name="TestCommandSOAP">
<soap:address location="http://www.example.org/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Thanks,
Kiran
_________________________________________________________________
Helping your favorite cause is as easy as instant messaging. You IM, we give.
http://im.live.com/Messenger/IM/Home/?source=text_hotmail_join
Re: Axis2 WSDL2Java generated weird method signatures in skeleton
Posted by Anne Thomas Manes <at...@gmail.com>.
Here's a sample WSDL from the WS-I Attachments Profile showing how to
define and bind your attachment:
<wsdl:definitions xmlns:types="http://example.com/mimetypes"
xmlns:ref="http://ws-i.org/profiles/basic/1.1/xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapbind="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://example.com/mimewsdl"
xmlns:tns="http://example.com/mimewsdl">
<wsdl:types>
<xsd:schema targetNamespace="http://example.com/mimetypes"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://ws-i.org/profiles/basic/1.1/xsd" />
<xsd:complexType name="ClaimDetailType">
<xsd:sequence>
<xsd:element name="Name" type="xsd:string"/>
<xsd:element name="ClaimForm" type="ref:swaRef"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="ClaimIn">
<wsdl:part name="ClaimDetail" type="types:ClaimDetailType"/>
<wsdl:part name="ClaimPhoto" type="xsd:base64Binary"/>
</wsdl:message>
<wsdl:message name="ClaimOut">
<wsdl:part name="ClaimRefNo" type="xsd:string"/>
</wsdl:message>
<wsdl:portType name="ClaimPortType">
<wsdl:operation name="SendClaim">
<wsdl:input message="tns:ClaimIn"/>
<wsdl:output message="tns:ClaimOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ClaimBinding" type="tns:ClaimPortType">
<soapbind:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="SendClaim">
<soapbind:operation soapAction="http://example.com/soapaction"/>
<wsdl:input>
<mime:multipartRelated>
<mime:part>
<soapbind:body use="literal"
parts="ClaimDetail"
namespace="http://example.com/mimetypes"/>
</mime:part>
<mime:part>
<mime:content part="ClaimPhoto"
type="image/jpeg"/>
</mime:part>
</mime:multipartRelated>
</wsdl:input>
<wsdl:output>
<soapbind:body use="literal"
namespace="http://example.com/mimetypes"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
</wsdl:definitions>
On Feb 10, 2008 10:29 PM, Anne Thomas Manes <at...@gmail.com> wrote:
> Your return type is defined as a SwA reference, but you don't have
> binary element defined (what the reference is supposed to reference,
> and your binding does not define a MIME attachment.
>
> Axis2 has only partial support for SwA -- you'd be better off switching to MTOM.
>
> Anne
>
>
> On Feb 9, 2008 2:14 PM, Kiran Sriram <ki...@hotmail.com> wrote:
> >
> > Hello,
> >
> > I am trying to implement a webservice using WSDL first approach. My
> > requirement is to add method signature which returns a file as an attachment
> > to caller. I am using SWA, wsi:swaRef as type of the return parameter. i
> > have imported the schema for it in my wsdl file. When i generated the server
> > side skeleton using Axis2 WSDL2Java tool, the method signature is generated
> > like this:
> >
> > public org.ws_i.profiles.basic._1_1.xsd.SwaRef
> > ContentExportAsAttachment
> > ( boolean attachType,java.lang.String
> > lock,java.lang.String traslation
> > )
> >
> >
> > I dont understand why it is generating the type of the return parameter
> > like this: org.ws_i.profiles.basic._1_1.xsd.SwaRef. This is not even getting
> > compiled now. I thought this should be mapped to
> > "javax.activation.DataHandler" class.
> > I have used adb binding here.
> >
> > I am pasting the wsdl file here, it is a simple wsdl with only one method.
> > style i used is document literal.
> >
> > Any help in this regard is greatly appreciated.
> >
> >
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> > xmlns:tns="http://www.example.org/TestCommand/"
> > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TestCommand"
> > targetNamespace="http://www.example.org/TestCommand/">
> >
> > <wsdl:types>
> >
> > <xsd:schema targetNamespace="http://www.example.org/TestCommand/"
> >
> > xmlns="http://www.w3.org/2001/XMLSchema"
> >
> > xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" >
> >
> >
> >
> > <import namespace="http://ws-i.org/profiles/basic/1.1/xsd"
> >
> > schemaLocation="http://ws-i.org/profiles/basic/1.1/swaref.xsd"/>
> >
> >
> >
> > <xsd:element name="ContentExportAsAttachment">
> >
> > <xsd:complexType>
> >
> > <xsd:sequence>
> >
> > <xsd:element name="attachType" type="xsd:boolean" />
> >
> > <xsd:element name="Lock" type="xsd:string"></xsd:element>
> >
> > <xsd:element name="Traslation" type="xsd:string"></xsd:element>
> >
> > </xsd:sequence>
> >
> > </xsd:complexType>
> >
> > </xsd:element>
> >
> > <xsd:element name="ContentExportAsAttachmentResponse">
> >
> > <xsd:complexType>
> >
> > <xsd:sequence>
> >
> > <xsd:element name="return" type="wsi:swaRef"/>
> >
> > </xsd:sequence>
> >
> > </xsd:complexType>
> >
> > </xsd:element>
> >
> > </xsd:schema>
> >
> > </wsdl:types>
> >
> > <wsdl:message name="ContentExportAsAttachmentRequest">
> >
> > <wsdl:part element="tns:ContentExportAsAttachment" name="parameters"/>
> >
> > </wsdl:message>
> >
> > <wsdl:message name="ContentExportAsAttachmentResponse">
> >
> > <wsdl:part element="tns:ContentExportAsAttachmentResponse"
> > name="parameters"/>
> >
> > </wsdl:message>
> >
> > <wsdl:portType name="TestCommand">
> >
> > <wsdl:operation name="ContentExportAsAttachment">
> >
> > <wsdl:input message="tns:ContentExportAsAttachmentRequest"/>
> >
> > <wsdl:output message="tns:ContentExportAsAttachmentResponse"/>
> >
> > </wsdl:operation>
> >
> > </wsdl:portType>
> >
> > <wsdl:binding name="TestCommandSOAP" type="tns:TestCommand">
> >
> > <soap:binding style="document"
> > transport="http://schemas.xmlsoap.org/soap/http"/>
> >
> > <wsdl:operation name="ContentExportAsAttachment">
> >
> > <soap:operation
> > soapAction="http://www.example.org/TestCommand/NewOperation"/>
> >
> > <wsdl:input>
> >
> > <soap:body use="literal"/>
> >
> > </wsdl:input>
> >
> > <wsdl:output>
> >
> > <soap:body use="literal"/>
> >
> > </wsdl:output>
> >
> > </wsdl:operation>
> >
> > </wsdl:binding>
> >
> > <wsdl:service name="TestCommand">
> >
> > <wsdl:port binding="tns:TestCommandSOAP" name="TestCommandSOAP">
> >
> > <soap:address location="http://www.example.org/"/>
> >
> > </wsdl:port>
> >
> > </wsdl:service>
> >
> > </wsdl:definitions>
> > Thanks,
> > Kiran
> >
> >
> > ________________________________
> > Helping your favorite cause is as easy as instant messaging. You IM, we
> > give. Learn more.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: Axis2 WSDL2Java generated weird method signatures in skeleton
Posted by Anne Thomas Manes <at...@gmail.com>.
Your return type is defined as a SwA reference, but you don't have
binary element defined (what the reference is supposed to reference,
and your binding does not define a MIME attachment.
Axis2 has only partial support for SwA -- you'd be better off switching to MTOM.
Anne
On Feb 9, 2008 2:14 PM, Kiran Sriram <ki...@hotmail.com> wrote:
>
> Hello,
>
> I am trying to implement a webservice using WSDL first approach. My
> requirement is to add method signature which returns a file as an attachment
> to caller. I am using SWA, wsi:swaRef as type of the return parameter. i
> have imported the schema for it in my wsdl file. When i generated the server
> side skeleton using Axis2 WSDL2Java tool, the method signature is generated
> like this:
>
> public org.ws_i.profiles.basic._1_1.xsd.SwaRef
> ContentExportAsAttachment
> ( boolean attachType,java.lang.String
> lock,java.lang.String traslation
> )
>
>
> I dont understand why it is generating the type of the return parameter
> like this: org.ws_i.profiles.basic._1_1.xsd.SwaRef. This is not even getting
> compiled now. I thought this should be mapped to
> "javax.activation.DataHandler" class.
> I have used adb binding here.
>
> I am pasting the wsdl file here, it is a simple wsdl with only one method.
> style i used is document literal.
>
> Any help in this regard is greatly appreciated.
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:tns="http://www.example.org/TestCommand/"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TestCommand"
> targetNamespace="http://www.example.org/TestCommand/">
>
> <wsdl:types>
>
> <xsd:schema targetNamespace="http://www.example.org/TestCommand/"
>
> xmlns="http://www.w3.org/2001/XMLSchema"
>
> xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" >
>
>
>
> <import namespace="http://ws-i.org/profiles/basic/1.1/xsd"
>
> schemaLocation="http://ws-i.org/profiles/basic/1.1/swaref.xsd"/>
>
>
>
> <xsd:element name="ContentExportAsAttachment">
>
> <xsd:complexType>
>
> <xsd:sequence>
>
> <xsd:element name="attachType" type="xsd:boolean" />
>
> <xsd:element name="Lock" type="xsd:string"></xsd:element>
>
> <xsd:element name="Traslation" type="xsd:string"></xsd:element>
>
> </xsd:sequence>
>
> </xsd:complexType>
>
> </xsd:element>
>
> <xsd:element name="ContentExportAsAttachmentResponse">
>
> <xsd:complexType>
>
> <xsd:sequence>
>
> <xsd:element name="return" type="wsi:swaRef"/>
>
> </xsd:sequence>
>
> </xsd:complexType>
>
> </xsd:element>
>
> </xsd:schema>
>
> </wsdl:types>
>
> <wsdl:message name="ContentExportAsAttachmentRequest">
>
> <wsdl:part element="tns:ContentExportAsAttachment" name="parameters"/>
>
> </wsdl:message>
>
> <wsdl:message name="ContentExportAsAttachmentResponse">
>
> <wsdl:part element="tns:ContentExportAsAttachmentResponse"
> name="parameters"/>
>
> </wsdl:message>
>
> <wsdl:portType name="TestCommand">
>
> <wsdl:operation name="ContentExportAsAttachment">
>
> <wsdl:input message="tns:ContentExportAsAttachmentRequest"/>
>
> <wsdl:output message="tns:ContentExportAsAttachmentResponse"/>
>
> </wsdl:operation>
>
> </wsdl:portType>
>
> <wsdl:binding name="TestCommandSOAP" type="tns:TestCommand">
>
> <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
>
> <wsdl:operation name="ContentExportAsAttachment">
>
> <soap:operation
> soapAction="http://www.example.org/TestCommand/NewOperation"/>
>
> <wsdl:input>
>
> <soap:body use="literal"/>
>
> </wsdl:input>
>
> <wsdl:output>
>
> <soap:body use="literal"/>
>
> </wsdl:output>
>
> </wsdl:operation>
>
> </wsdl:binding>
>
> <wsdl:service name="TestCommand">
>
> <wsdl:port binding="tns:TestCommandSOAP" name="TestCommandSOAP">
>
> <soap:address location="http://www.example.org/"/>
>
> </wsdl:port>
>
> </wsdl:service>
>
> </wsdl:definitions>
> Thanks,
> Kiran
>
>
> ________________________________
> Helping your favorite cause is as easy as instant messaging. You IM, we
> give. Learn more.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org