Codehaus XFire

Documentation

Quicklinks

Developers

Sponsors

You get a DynamicClient when you create a Client with the URL of a WSDL.

Example:

public void testCurrencyConverter() throws MalformedURLException, Exception
    {
        Client client = new Client(new URL("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL"));

        Object[] results = client.invoke("ConversionRate", new Object[] {"BRL", "UGX"});

        // Service returns a double of the currency conversion rate.
        System.out.println((Double) results[0]);
    }

TODO: Need an example or explanation: how to pass complex types in the request, for example how to initialize HotwireFlow from the ORACLEs BPEL samples.

<?xml version="1.0" encoding="UTF-8"?>
<definitions
     name="HotwireFlow"
     targetNamespace="http://samples.otn.com"
     xmlns="http://schemas.xmlsoap.org/wsdl/"
     xmlns:tns="http://samples.otn.com"
     xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing"
     xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    >
    <types>
        <schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://samples.otn.com"
             xmlns="http://www.w3.org/2001/XMLSchema">
            <element name="flightRequest" type="tns:FlightRequestType"/>
            <element name="approve" type="boolean"/>
            <element name="cancel" type="boolean"/>
            <element name="offer" type="double"/>
            <complexType name="FlightRequestType">
                <sequence>

                    <element name="from" type="string"/>
                    <element name="to" type="string"/>
                    <element name="business" type="boolean"/>
                    <element name="price" type="double"/>
                    <element name="status" type="string"/>
                    <element name="confirmationId" type="string"/>
                </sequence>
            </complexType>
        </schema>

        <schema xmlns="http://www.w3.org/2001/XMLSchema">
            <import namespace="http://schemas.xmlsoap.org/ws/2003/03/addressing" schemaLocation="http://SEA-ignaytev:9700/orabpel/xmllib/ws-addressing.xsd"/>
        </schema>
    </types>
    <message name="WSAReplyToHeader">
        <part name="ReplyTo" element="wsa:ReplyTo"/>
    </message>
    <message name="HotwireFlowResultMessage">
        <part name="payload" element="tns:flightRequest"/>

    </message>
    <message name="HotwireFlowCancelMessage">
        <part name="payload" element="tns:cancel"/>
    </message>
    <message name="WSARelatesToHeader">
        <part name="RelatesTo" element="wsa:RelatesTo"/>
    </message>
    <message name="WSAMessageIDHeader">
        <part name="MessageID" element="wsa:MessageID"/>

    </message>
    <message name="HotwireFlowOfferMessage">
        <part name="payload" element="tns:offer"/>
    </message>
    <message name="HotwireFlowApproveMessage">
        <part name="payload" element="tns:approve"/>
    </message>
    <message name="HotwireFlowRequestMessage">
        <part name="payload" element="tns:flightRequest"/>

    </message>
    <portType name="HotwireFlow">
        <operation name="initiate">
            <input message="tns:HotwireFlowRequestMessage"/>
        </operation>
        <operation name="approve">
            <input message="tns:HotwireFlowApproveMessage"/>
        </operation>
        <operation name="cancel">

            <input message="tns:HotwireFlowCancelMessage"/>
        </operation>
    </portType>
    <portType name="HotwireFlowCallback">
        <operation name="onResult">
            <input message="tns:HotwireFlowResultMessage"/>
        </operation>
        <operation name="onOffer">
            <input message="tns:HotwireFlowOfferMessage"/>

        </operation>
    </portType>
    <binding name="HotwireFlowCallbackBinding" type="tns:HotwireFlowCallback">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="onResult">
            <soap:operation style="document" soapAction="onResult"/>
            <input>
                <soap:header message="tns:WSARelatesToHeader" part="RelatesTo" use="literal" encodingStyle=""/>
                <soap:body use="literal"/>

            </input>
        </operation>
        <operation name="onOffer">
            <soap:operation style="document" soapAction="onOffer"/>
            <input>
                <soap:header message="tns:WSARelatesToHeader" part="RelatesTo" use="literal" encodingStyle=""/>
                <soap:body use="literal"/>
            </input>
        </operation>

    </binding>
    <binding name="HotwireFlowBinding" type="tns:HotwireFlow">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="initiate">
            <soap:operation style="document" soapAction="initiate"/>
            <input>
                <soap:header message="tns:WSAReplyToHeader" part="ReplyTo" use="literal" encodingStyle=""/>
                <soap:header message="tns:WSAMessageIDHeader" part="MessageID" use="literal" encodingStyle=""/>
                <soap:body use="literal"/>

            </input>
        </operation>
        <operation name="approve">
            <soap:operation style="document" soapAction="approve"/>
            <input>
                <soap:header message="tns:WSARelatesToHeader" part="RelatesTo" use="literal" encodingStyle=""/>
                <soap:body use="literal"/>
            </input>
        </operation>

        <operation name="cancel">
            <soap:operation style="document" soapAction="cancel"/>
            <input>
                <soap:header message="tns:WSARelatesToHeader" part="RelatesTo" use="literal" encodingStyle=""/>
                <soap:body use="literal"/>
            </input>
        </operation>
    </binding>
    <service name="HotwireFlow">

        <port name="HotwireFlowPort" binding="tns:HotwireFlowBinding">
            <soap:address location="http://SEA-ignaytev:9700/orabpel/default/HotwireFlow/1.0"/>
        </port>
    </service>
    <service name="HotwireFlowCallbackService">
        <port name="HotwireFlowCallbackPort" binding="tns:HotwireFlowCallbackBinding">
            <soap:address location="http://set.by.caller"/>
        </port>
    </service>

  <plnk:partnerLinkType name="HotwireFlow">
    <plnk:role name="HotwireFlowProvider">
      <plnk:portType name="tns:HotwireFlow"/>
    </plnk:role>
    <plnk:role name="HotwireFlowRequester">
      <plnk:portType name="tns:HotwireFlowCallback"/>
    </plnk:role>
  </plnk:partnerLinkType>
</definitions>