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 David Ojeda <do...@integra.la> on 2008/08/13 22:26:38 UTC
Adding header elements to a response
Hello all,
I've never used the soap header in a WS client or server, but now I need to add
a simple true/false element to a soap response.
How can I do this?
I managed to declare this in the wsdl using soap:header, but there is nothing in
the Skeleton that lets me add a header element.
Could you please help me?
Here is my WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
name="WSIterautoID"
targetNamespace="http://www.openuri.org/ws/iterauto/WSIterautoID/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://www.openuri.org/ws/iterauto/WSIterautoID/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd1="http://www.openuri.org/ws/dummy">
<wsdl:types>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.openuri.org/ws/iterauto/WSIterautoID/">
<xsd:element name="getIterautoIDResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element
name="iterautoID"
type="xsd:string">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="WSIterautoIDException">
<xsd:sequence>
<xsd:element
name="code"
type="xsd:string">
</xsd:element>
<xsd:element
name="msg"
type="xsd:string">
</xsd:element>
<xsd:element
name="trace"
type="xsd:string">
</xsd:element>
<xsd:element
name="from"
type="xsd:string">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element
name="getIterautoIDFault"
type="tns:WSIterautoIDException">
</xsd:element>
<xsd:element
name="hasMoreElementsHeader"
type="xsd:boolean">
</xsd:element>
</xsd:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import
namespace="http://www.openuri.org/ws/dummy"
schemaLocation="../xsd/DummyInput.xsd">
</xsd:import></xsd:schema></wsdl:types>
<wsdl:message name="getIterautoIDRequest">
<wsdl:part
name="input" element="xsd1:EmptyRequest">
</wsdl:part></wsdl:message>
<wsdl:message name="getIterautoIDResponse">
<wsdl:part
name="id" element="tns:getIterautoIDResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="IterautoIDFault">
<wsdl:part
name="fault" element="tns:getIterautoIDFault">
</wsdl:part>
</wsdl:message>
<wsdl:message name="hasMoreElementsHeader">
<wsdl:part
name="hasMoreElementsHeader" element="tns:hasMoreElementsHeader">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="WSIterautoID">
<wsdl:operation name="getIterautoID">
<wsdl:input message="tns:getIterautoIDRequest"></wsdl:input>
<wsdl:output message="tns:getIterautoIDResponse"></wsdl:output>
<wsdl:fault
name="WSIterautoIDException"
message="tns:IterautoIDFault">
</wsdl:fault>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding
name="WSIterautoIDSOAP"
type="tns:WSIterautoID">
<soap:binding
style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="getIterautoID">
<soap:operation
soapAction="http://www.openuri.org/ws/iterauto/WSIterautoID/getIterautoID" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:header use="literal" part="hasMoreElementsHeader"
message="tns:hasMoreElementsHeader"/>
<soap:body use="literal" />
</wsdl:output>
<wsdl:fault name="WSIterautoIDException">
<soap:fault
name="WSIterautoIDException"
use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="WSIterautoID">
<wsdl:port
name="WSIterautoID"
binding="tns:WSIterautoIDSOAP">
<soap:address
location="http://10.21.17.196:8080/WebServices/services/WSIterautoID" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
--
Ing. David Ojeda
Integra Consultores
Caracas, Venezuela
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: Adding header elements to a response
Posted by David Ojeda <do...@integra.la>.
I have managed to solve this using the toOM method in the MessageReceiverInOut
generated by the wsdl.
On Wednesday 13 August 2008 03:59:42 pm David Ojeda wrote:
> I forgot to mention that I am using Axis 2 1.4
>
> On Wednesday 13 August 2008 03:56:38 pm David Ojeda wrote:
> > Hello all,
> >
> > I've never used the soap header in a WS client or server, but now I need
> > to add a simple true/false element to a soap response.
> > How can I do this?
> > I managed to declare this in the wsdl using soap:header, but there is
> > nothing in the Skeleton that lets me add a header element.
> >
> > Could you please help me?
> >
> > Here is my WSDL:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <wsdl:definitions
> > name="WSIterautoID"
> > targetNamespace="http://www.openuri.org/ws/iterauto/WSIterautoID/"
> > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> > xmlns:tns="http://www.openuri.org/ws/iterauto/WSIterautoID/"
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> > xmlns:xsd1="http://www.openuri.org/ws/dummy">
> > <wsdl:types>
> > <xsd:schema
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > targetNamespace="http://www.openuri.org/ws/iterauto/WSIterautoID/">
> > <xsd:element name="getIterautoIDResponse">
> > <xsd:complexType>
> > <xsd:sequence>
> > <xsd:element
> > name="iterautoID"
> > type="xsd:string">
> > </xsd:element>
> > </xsd:sequence>
> > </xsd:complexType>
> > </xsd:element>
> > <xsd:complexType name="WSIterautoIDException">
> > <xsd:sequence>
> > <xsd:element
> > name="code"
> > type="xsd:string">
> > </xsd:element>
> > <xsd:element
> > name="msg"
> > type="xsd:string">
> > </xsd:element>
> > <xsd:element
> > name="trace"
> > type="xsd:string">
> > </xsd:element>
> > <xsd:element
> > name="from"
> > type="xsd:string">
> > </xsd:element>
> > </xsd:sequence>
> > </xsd:complexType>
> > <xsd:element
> > name="getIterautoIDFault"
> > type="tns:WSIterautoIDException">
> > </xsd:element>
> >
> > <xsd:element
> > name="hasMoreElementsHeader"
> > type="xsd:boolean">
> > </xsd:element>
> > </xsd:schema>
> > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> > <xsd:import
> > namespace="http://www.openuri.org/ws/dummy"
> > schemaLocation="../xsd/DummyInput.xsd">
> > </xsd:import></xsd:schema></wsdl:types>
> > <wsdl:message name="getIterautoIDRequest">
> > <wsdl:part
> > name="input" element="xsd1:EmptyRequest">
> > </wsdl:part></wsdl:message>
> > <wsdl:message name="getIterautoIDResponse">
> > <wsdl:part
> > name="id" element="tns:getIterautoIDResponse">
> > </wsdl:part>
> > </wsdl:message>
> > <wsdl:message name="IterautoIDFault">
> > <wsdl:part
> > name="fault" element="tns:getIterautoIDFault">
> > </wsdl:part>
> > </wsdl:message>
> > <wsdl:message name="hasMoreElementsHeader">
> > <wsdl:part
> > name="hasMoreElementsHeader" element="tns:hasMoreElementsHeader">
> > </wsdl:part>
> > </wsdl:message>
> > <wsdl:portType name="WSIterautoID">
> > <wsdl:operation name="getIterautoID">
> > <wsdl:input message="tns:getIterautoIDRequest"></wsdl:input>
> > <wsdl:output message="tns:getIterautoIDResponse"></wsdl:output>
> > <wsdl:fault
> > name="WSIterautoIDException"
> > message="tns:IterautoIDFault">
> > </wsdl:fault>
> > </wsdl:operation>
> > </wsdl:portType>
> > <wsdl:binding
> > name="WSIterautoIDSOAP"
> > type="tns:WSIterautoID">
> > <soap:binding
> > style="document"
> > transport="http://schemas.xmlsoap.org/soap/http" />
> > <wsdl:operation name="getIterautoID">
> > <soap:operation
> >
> > soapAction="http://www.openuri.org/ws/iterauto/WSIterautoID/getIterautoID
> >" /> <wsdl:input>
> > <soap:body use="literal" />
> > </wsdl:input>
> > <wsdl:output>
> > <soap:header use="literal" part="hasMoreElementsHeader"
> > message="tns:hasMoreElementsHeader"/>
> > <soap:body use="literal" />
> > </wsdl:output>
> > <wsdl:fault name="WSIterautoIDException">
> > <soap:fault
> > name="WSIterautoIDException"
> > use="literal"/>
> > </wsdl:fault>
> > </wsdl:operation>
> > </wsdl:binding>
> > <wsdl:service name="WSIterautoID">
> > <wsdl:port
> > name="WSIterautoID"
> > binding="tns:WSIterautoIDSOAP">
> > <soap:address
> > location="http://10.21.17.196:8080/WebServices/services/WSIterautoID"
> > /> </wsdl:port>
> > </wsdl:service>
> > </wsdl:definitions>
--
Ing. David Ojeda
Integra Consultores
Caracas, Venezuela
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: Adding header elements to a response
Posted by David Ojeda <do...@integra.la>.
I forgot to mention that I am using Axis 2 1.4
On Wednesday 13 August 2008 03:56:38 pm David Ojeda wrote:
> Hello all,
>
> I've never used the soap header in a WS client or server, but now I need to
> add a simple true/false element to a soap response.
> How can I do this?
> I managed to declare this in the wsdl using soap:header, but there is
> nothing in the Skeleton that lets me add a header element.
>
> Could you please help me?
>
> Here is my WSDL:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions
> name="WSIterautoID"
> targetNamespace="http://www.openuri.org/ws/iterauto/WSIterautoID/"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:tns="http://www.openuri.org/ws/iterauto/WSIterautoID/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:xsd1="http://www.openuri.org/ws/dummy">
> <wsdl:types>
> <xsd:schema
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.openuri.org/ws/iterauto/WSIterautoID/">
> <xsd:element name="getIterautoIDResponse">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element
> name="iterautoID"
> type="xsd:string">
> </xsd:element>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> <xsd:complexType name="WSIterautoIDException">
> <xsd:sequence>
> <xsd:element
> name="code"
> type="xsd:string">
> </xsd:element>
> <xsd:element
> name="msg"
> type="xsd:string">
> </xsd:element>
> <xsd:element
> name="trace"
> type="xsd:string">
> </xsd:element>
> <xsd:element
> name="from"
> type="xsd:string">
> </xsd:element>
> </xsd:sequence>
> </xsd:complexType>
> <xsd:element
> name="getIterautoIDFault"
> type="tns:WSIterautoIDException">
> </xsd:element>
>
> <xsd:element
> name="hasMoreElementsHeader"
> type="xsd:boolean">
> </xsd:element>
> </xsd:schema>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <xsd:import
> namespace="http://www.openuri.org/ws/dummy"
> schemaLocation="../xsd/DummyInput.xsd">
> </xsd:import></xsd:schema></wsdl:types>
> <wsdl:message name="getIterautoIDRequest">
> <wsdl:part
> name="input" element="xsd1:EmptyRequest">
> </wsdl:part></wsdl:message>
> <wsdl:message name="getIterautoIDResponse">
> <wsdl:part
> name="id" element="tns:getIterautoIDResponse">
> </wsdl:part>
> </wsdl:message>
> <wsdl:message name="IterautoIDFault">
> <wsdl:part
> name="fault" element="tns:getIterautoIDFault">
> </wsdl:part>
> </wsdl:message>
> <wsdl:message name="hasMoreElementsHeader">
> <wsdl:part
> name="hasMoreElementsHeader" element="tns:hasMoreElementsHeader">
> </wsdl:part>
> </wsdl:message>
> <wsdl:portType name="WSIterautoID">
> <wsdl:operation name="getIterautoID">
> <wsdl:input message="tns:getIterautoIDRequest"></wsdl:input>
> <wsdl:output message="tns:getIterautoIDResponse"></wsdl:output>
> <wsdl:fault
> name="WSIterautoIDException"
> message="tns:IterautoIDFault">
> </wsdl:fault>
> </wsdl:operation>
> </wsdl:portType>
> <wsdl:binding
> name="WSIterautoIDSOAP"
> type="tns:WSIterautoID">
> <soap:binding
> style="document"
> transport="http://schemas.xmlsoap.org/soap/http" />
> <wsdl:operation name="getIterautoID">
> <soap:operation
>
> soapAction="http://www.openuri.org/ws/iterauto/WSIterautoID/getIterautoID"
> /> <wsdl:input>
> <soap:body use="literal" />
> </wsdl:input>
> <wsdl:output>
> <soap:header use="literal" part="hasMoreElementsHeader"
> message="tns:hasMoreElementsHeader"/>
> <soap:body use="literal" />
> </wsdl:output>
> <wsdl:fault name="WSIterautoIDException">
> <soap:fault
> name="WSIterautoIDException"
> use="literal"/>
> </wsdl:fault>
> </wsdl:operation>
> </wsdl:binding>
> <wsdl:service name="WSIterautoID">
> <wsdl:port
> name="WSIterautoID"
> binding="tns:WSIterautoIDSOAP">
> <soap:address
> location="http://10.21.17.196:8080/WebServices/services/WSIterautoID"
> /> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
--
Ing. David Ojeda
Integra Consultores
Caracas, Venezuela
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org