Round4/GroupH/SOAPFault

The standard WSDL description listed below can be found here. You can find additional information at the SOAP Builders round 4 site.

WSDL Interface

<?xml version="1.0" encoding="UTF-8"?>
<definitions
        xmlns="http://schemas.xmlsoap.org/wsdl/"
        xmlns:tns="http://soapinterop.org/wsdl"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:ns2="http://soapinterop.org/types"
        targetNamespace="http://soapinterop.org/wsdl">
                                                                           
        <message name="echoVoidRequest"/>
        <message name="echoVoidResponse"/>
        <message name="HeaderRequest">
                <part name="param" type="xsd:string"/>
        </message>
                                                                           
        <portType name="SOAPFaultPortType">
                <operation name="echoVersionMismatchFault" parameterOrder="">
                        <input message="tns:echoVoidRequest"/>
                        <output message="tns:echoVoidResponse"/>
                </operation>
                                                                           
                <operation name="echoMustUnderstandFault" parameterOrder="">
                        <input message="tns:echoVoidRequest"/>
                        <output message="tns:echoVoidResponse"/>
                </operation>
        </portType>
                                                                           
        <binding name="SOAPFaultBinding" type="tns:SOAPFaultPortType">
                <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
                <!--
                        If the server receives an envelope with an incorrect
                        namespace, then a fault with VersionMismatch fault code
                        is populated in the SOAP response
                -->
                <operation name="echoVersionMismatchFault">
                        <input>
                                <soap:body
                                        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                                        use="encoded"
                                        namespace="http://soapinterop.org/wsdl"/>
                        </input>
                        <output>
                                <soap:body
                                        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                                        use="encoded"
                                        namespace="http://soapinterop.org/wsdl"/>
                        </output>
                        <soap:operation soapAction=""/>
                </operation>
                                                                           
                <operation name="echoMustUnderstandFault">
                        <input>
                                <soap:body
                                        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                                        use="encoded"
                                        namespace="http://soapinterop.org/wsdl"/>
                                <soap:header
                                        message="tns:HeaderRequest"
                                        part="param"
                                        use="encoded"
                                        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                        </input>
                        <output>
                                <soap:body
                                        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                                        use="encoded"
                                        namespace="http://soapinterop.org/wsdl"/>
                        </output>
                        <soap:operation soapAction=""/>
                </operation>
                                                                           
        </binding>
                                                                           
        <service name="SOAPFaultService">
                <port name="SOAPFaultPort" binding="tns:SOAPFaultBinding">
                        <soap:address
                                location="http://soapinterop.novell.com/round4/grouph/soapfault"/>
                </port>
        </service>
</definitions>
                                                                           
                                                                           

Client

If you invoke wsdl2java on the above WSDL document, you can run this client to interact with the service:

package grouph.soapfault;
                                                                           
import java.util.ArrayList;
                                                                           
import javax.xml.namespace.QName;
                                                                           
import javax.naming.InitialContext;
import javax.xml.rpc.Stub;
                                                                           
import javax.xml.rpc.handler.HandlerInfo;
                                                                           
public class Client
{
    public static void main(String[] args) throws Exception
    {
    |   InitialContext ctx = new InitialContext();
    |   SOAPFaultService service = (SOAPFaultService)
    |           ctx.lookup("xmlrpc:soap:grouph.soapfault.SOAPFaultService");
    |                                                                      
    |   // set the handler chain
    |   QName portName = new QName("http://soapinterop.org/wsdl", 
    |                           "SOAPFaultPort");
    |   ArrayList handlers = new ArrayList();
    |   handlers.add(new HandlerInfo(SOAPFaultHandler.class, null, null));      
    |   service.getHandlerRegistry().setHandlerChain(portName, handlers);
    |                                                                      
    |   SOAPFaultPortType stub = service.getSOAPFaultPort();
    |                                                                      
    |   // set the end point address
    |   if (args.length > 0) 
    |       ((Stub)stub)._setProperty("javax.xml.rpc.service.endpoint.address",
    |           args[0]);
    |                                                                      
    |   echoVersionMismatchFault(stub);
    |   echoMustUnderstandFault(stub);
    }
                                                                           
                                                                           
    public static void echoVersionMismatchFault(SOAPFaultPortType stub)
    {
    |   try
    |   {
    |   |   System.out.print("echoVersionMismatchFault: ");
    |   |   boolean result = Tests.echoVersionMismatchFault(stub);
    |   |   System.out.println(result ? "OK" : "failed");
    |   }
    |   catch (java.lang.Exception ex)
    |   {
    |   |   System.out.println("error invoking echoVersionMismatchFault:" + 
    |   |       ex.getMessage());
    |   |   if (java.lang.System.getProperty("DEBUG") != null)
    |   |       ex.printStackTrace();
    |   }
    }
                                                                           
    public static void echoMustUnderstandFault(SOAPFaultPortType stub)
    {
    |   try
    |   {
    |   |   System.out.print("echoMustUnderstandFault: ");
    |   |   boolean result = Tests.echoMustUnderstandFault(stub);
    |   |   System.out.println(result ? "OK" : "failed");
    |   }
    |   catch (java.lang.Exception ex)
    |   {
    |   |   System.out.println("error invoking echoMustUnderstandFault:" + 
    |   |       ex.getMessage());
    |   |   if (java.lang.System.getProperty("DEBUG") != null)
    |   |       ex.printStackTrace();
    |   }
    }
}

Server

An implementation of the service endpoint from the above WSDL is listed below:

// Thu Oct 03 12:38:40 PDT 2002
                                                                           
package grouph.soapfault;
                                                                           
import javax.servlet.ServletException;
                                                                           
public class ServerImpl extends SOAPFaultPortType_ServiceSkeleton
{
    public void init()
        throws ServletException
    {
    |   super.init();
    |                                                                      
    |   // Set the WSDL file property
    |   _setProperty("xmlrpc.wsdl", "soapfault.wsdl");
    }
                                                                           
    public void echoVersionMismatchFault()
        throws java.rmi.RemoteException
    {
    }
                                                                           
    public void echoMustUnderstandFault()
        throws java.rmi.RemoteException
    {
    }
}


Copyright © 2003, 2004 Novell, Inc. All rights reserved. Copyright © 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved.