Hello Robert,

I'm going crazy with Axis2 and Failures...

I attached
- a simplified WSDL file which seems to be valid (validated with the WSDL Validator of the Eclipse WTP Project).
- the services.xml
- My serverside Skeleton
- My simple Client
- The xml-request
- The xml-response
- The Exception

Thank you for your help,

Siamak Haschemi

--

<?xml version="1.0" encoding="http://schemas.xmlsoap.org/soap/envelope/";?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
<soapenv:Header/>
<soapenv:Body>
<getProductRequest xmlns="http://www.haschemi.org/fault/";>Test</getProductRequest>
</soapenv:Body>
</soapenv:Envelope>

--

<?xml version="1.0" encoding="http://schemas.xmlsoap.org/soap/envelope/";?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
<soapenv:Header/>
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>GetProductFaultException</faultstring>
<detail>
<getProductFault xmlns="http://www.haschemi.org/fault/";>Dicker Fehler!</getProductFault>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

--

Exception in thread "main" java.lang.RuntimeException: Data binding error
   at org.apache.axis2.FaultStub.fromOM(FaultStub.java:407)
   at org.apache.axis2.FaultStub.getProduct(FaultStub.java:174)
   at Client.main(Client.java:16)
Caused by: java.lang.NullPointerException
at org.apache.xmlbeans.impl.store.Cur$CurLoadContext.finish(Cur.java:3184) at org.apache.xmlbeans.impl.store.Locale.loadXMLStreamReader(Locale.java:1216) at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:843) at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:826) at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:231) at org.haschemi.www.fault.GetProductFaultDocument$Factory.parse(GetProductFaultDocument.java:88)
   at org.apache.axis2.FaultStub.fromOM(FaultStub.java:403)
   ... 2 more

robert lazarski schrieb:
Try validating your wsdl file - I'm seeing some warning about missing types
around getAllProductRequest .

HTH,
Robert
http://www.braziloutsource.com/

On 4/24/06, Siamak Haschemi <[EMAIL PROTECTED]> wrote:
Hello to all.

I posted this failure in the user-list but nobody responses, so I'll try
to reach the developers because it seems like a bug.

I generated with the attached WSDL file the serverside and the
clientside code.

The reqiest from the Client is:

<?xml version="1.0" encoding="http://schemas.xmlsoap.org/soap/envelope/";?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
">
<soapenv:Header/>
<soapenv:Body>
<saveProductRequest xmlns="http://haschemi.org/shop/common";>
<product amount="11.0" amountUnit="kg" calorificValue="15000"
dateOfExpiry="2006-04-24+02:00" description="Tolles Brot mit tollen
Eigenschaften...." fromTemperatureRange="-15.0" name="Hagen Brot"
toTemperatureRange="30.0"/>
</saveProductRequest>
</soapenv:Body>
</soapenv:Envelope>

In the Server Skeleton I throw a Exception:

public SaveProductResponseDocument
saveProduct(SaveProductRequestDocument param1) OperationException {
  final OperationException exception = new OperationException();
  final ExceptionMessageDocument exceptionMessageDocument =
ExceptionMessageDocument.Factory.newInstance();
  final ExceptionMessage exceptionMessage =
exceptionMessageDocument.addNewExceptionMessage();
  final LocalizedMessage localizedMessage =
exceptionMessage.addNewLocalizedMessage();
  localizedMessage.setLanguage(LocalizedMessage.Language.DE_DE);
  localizedMessage.setMessage("Fehlerbescrhreibung");
  exception.setFaultMessage(exceptionMessageDocument);
  throw exception;
}


And the response is:

<?xml version="1.0" encoding="http://schemas.xmlsoap.org/soap/envelope/";?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
">
<soapenv:Header/>
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>OperationException</faultstring>
<detail>
<exceptionMessage xmlns="http://haschemi.org/shop/common";>
<localizedMessage language="de_DE" message="Fehlerbescrhreibung"/>
</exceptionMessage>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>


The client receives the response and throws:

org.apache.axiom.om.OMException: java.lang.NullPointerException
    at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java
:207)
    at
org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(
OMElementImpl.java:263)
    at
org.apache.axiom.om.impl.traverse.OMChildrenIterator.next(
OMChildrenIterator.java:111)
    at
org.apache.axiom.soap.impl.llom.SOAPFaultImpl.getChildWithName(
SOAPFaultImpl.java:187)
    at
org.apache.axiom.soap.impl.llom.SOAPFaultImpl.getNode(SOAPFaultImpl.java
:119)
    at
org.apache.axis2.description.OutInAxisOperationClient.execute(
OutInAxisOperation.java:286)
    at org.apache.axis2.CareStub.saveProduct(CareStub.java:277)
    at Client.main(Client.java:53)
Caused by: java.lang.NullPointerException
    at
org.apache.axiom.soap.impl.builder.SOAPBuilderHelper.processAttributes(
SOAPBuilderHelper.java:90)
    at
org.apache.axiom.soap.impl.builder.SOAP11BuilderHelper.handleEvent(
SOAP11BuilderHelper.java:146)
    at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(
StAXSOAPModelBuilder.java:310)
    at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(
StAXSOAPModelBuilder.java:177)
    at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java
:133)
    ... 7 more


So, did I something wrong?
Is there a miskate in the WSDL-file?

Thanks for the help


Siamak Haschemi





/**
 * FaultSkeleton.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis2 version: SNAPSHOT Apr 24, 2006 (08:15:33 CEST)
 */
package org.apache.axis2;

import org.haschemi.www.fault.GetProductFaultDocument;

/**
 * FaultSkeleton java skeleton for the axisService
 */
public class FaultSkeleton {

        /**
         * Auto generated method signature
         * 
         * @param param0
         * 
         */
        public org.haschemi.www.fault.GetProductResponseDocument getProduct(
                        org.haschemi.www.fault.GetProductRequestDocument param0)

        throws org.apache.axis2.FaultSkeleton.GetProductFaultException {
                final GetProductFaultException exception = new 
GetProductFaultException();
                final GetProductFaultDocument document = 
GetProductFaultDocument.Factory.newInstance();
                document.setGetProductFault("Dicker Fehler!");

                exception.setFaultMessage(document);

                throw exception;
        }

        public static class GetProductFaultException extends 
java.rmi.RemoteException {

                private org.haschemi.www.fault.GetProductFaultDocument 
faultMessage;

                public void 
setFaultMessage(org.haschemi.www.fault.GetProductFaultDocument msg) {
                        faultMessage = msg;
                }

                public org.haschemi.www.fault.GetProductFaultDocument 
getFaultMessage() {
                        return faultMessage;
                }
        }

}
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
  xmlns:tns="http://www.haschemi.org/fault/"; xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"; name="f"
  targetNamespace="http://www.haschemi.org/fault/";>
  <wsdl:types>
    <xsd:schema targetNamespace="http://www.haschemi.org/fault/";>
      <xsd:element name="getProductResponse" type="xsd:string" />
      <xsd:element name="getProductRequest" type="xsd:string" />
      <xsd:element name="getProductFault" type="xsd:string"></xsd:element>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="getProductResponse">
    <wsdl:part name="getProductResponse" element="tns:getProductResponse" />
  </wsdl:message>
  <wsdl:message name="getProductRequest">
    <wsdl:part name="getProductRequest" element="tns:getProductRequest" />
  </wsdl:message>
  <wsdl:message name="getProductFault">
    <wsdl:part name="getProductFault" element="tns:getProductFault"></wsdl:part>
  </wsdl:message>
  <wsdl:portType name="fault">
    <wsdl:operation name="getProduct">
      <wsdl:input name="getProductRequest" message="tns:getProductRequest" />
      <wsdl:output name="getProductResponse" message="tns:getProductResponse" />
      <wsdl:fault name="getProductFault" message="tns:getProductFault" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="faultSOAP" type="tns:fault">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"; />
    <wsdl:operation name="getProduct">
      <soap:operation soapAction="http://www.haschemi.org/fault/getProduct"; />
      <wsdl:input>
        <soap:body parts="getProductRequest" use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body parts="getProductResponse" use="literal" />
      </wsdl:output>
      <wsdl:fault name="getProductFault">
        <soap:fault name="getProductFault" use="literal" />
      </wsdl:fault>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="fault">
    <wsdl:port binding="tns:faultSOAP" name="faultSOAP">
      <soap:address location="http://www.example.org/"; />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
<!-- This file was auto-generated from WSDL -->
<!-- by the Apache Axis2 version: #axisVersion# #today# -->
<serviceGroup>
  <service name="fault">
    <messageReceivers>
      <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out";
        class="org.apache.axis2.FaultMessageReceiverInOut" />
    </messageReceivers>
    <parameter name="ServiceClass" locked="false">org.apache.axis2.FaultSkeleton</parameter>
    <operation name="getProduct" mep="http://www.w3.org/2004/08/wsdl/in-out";>
      <actionMapping>http://www.haschemi.org/fault/getProduct</actionMapping>
    </operation>
  </service>
</serviceGroup>
import org.apache.axis2.FaultStub;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.haschemi.www.fault.GetProductRequestDocument;

public class Client {
        public static void main(String[] args) throws Exception {
                ConfigurationContext configContext = ConfigurationContextFactory
                                
.createConfigurationContextFromFileSystem("client_repo", null);

                final FaultStub faultStub = new FaultStub(configContext,
                                "http://localhost:1234/axis2/services/fault";);

                final GetProductRequestDocument document = 
GetProductRequestDocument.Factory.newInstance();
                document.setGetProductRequest("Test");
                faultStub.getProduct(document);
        }
}

Reply via email to