Hello again.
Maybe someone could geive me a hint how to enable the Logging output of
the Axiom package.
Every log4.properties I doesn't work. So can you please help me to
enable the outputs so I can see where the Problem lies?
Thank you very much.
Siamak Haschemi
Siamak Haschemi schrieb:
Hello to all.
I've created a custom Exception in the WSDL-File which I have attached
with this eMail. I hope that is O.K.
I generate the serverside Skeleton with WSDL2Java. In the
Skeleton-code I throw the Exception like below.
I also listed the request and the response. The problem is that after
receiving the response (containing the Exception) the client throws a
Exception.
I also added the StackStrace.
I dont't know where to start.
Thank you very much,
Siamak Haschemi
THROWING THE EXCEPTION ON SERVERSIDE
public SaveProductResponseDocument
saveProduct(SaveProductRequestDocument param0) throws
CategoryNotFoundException {
final CategoryNotFoundException exception = new
CategoryNotFoundException();
final LocalizedMessageDocument localizedMessageDocument =
LocalizedMessageDocument.Factory.newInstance();
final LocalizedMessage localizedMessage =
localizedMessageDocument.addNewLocalizedMessage();
final MessageType enMessage = localizedMessage.addNewMessage();
enMessage.setMessage("Hello Wolrd");
enMessage.setLanguage(MessageType.Language.EN_US);
exception.setFaultMessage(localizedMessageDocument);
throw exception;
}
REQUEST FROM CLIENT
<?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="1.0" amountUnit="l" calorificValue="500"
dateOfExpiry="2006-04-21+02:00" description="Geile Mlich"
fromTemperatureRange="2.0" name="Wonder Milch"
toTemperatureRange="15.0"/>
<product amount="11.0" amountUnit="kg" calorificValue="15000"
dateOfExpiry="2006-04-21+02:00" description="Tolles Brot mit tollen
Eigenschaften...." fromTemperatureRange="-15.0" name="Hagen Brot"
toTemperatureRange="30.0"/>
</saveProductRequest>
</soapenv:Body>
</soapenv:Envelope>
RESPONSE FROM SERVER
<?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>CategoryNotFoundException</faultstring>
<detail>
<localizedMessage xmlns="http://haschemi.org/shop/common">
<message language="en_US" message="Hello Wolrd"/>
</localizedMessage>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
THE EXCEPTION ON THE CLIENTSIDE
Exception in thread "main" org.apache.axiom.om.OMException:
java.lang.NullPointerException
at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:192)
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:275)
at org.apache.axis2.CareStub.saveProduct(CareStub.java:149)
at Client.main(Client.java:73)
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:118)
... 7 more
------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="shop" targetNamespace="http://haschemi.org/shop"
xmlns:ss="http://haschemi.org/shop"
xmlns:common="http://haschemi.org/shop/common">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
targetNamespace="http://haschemi.org/shop/common">
<xsd:complexType name="product-type">
<xsd:sequence>
<xsd:element name="categoryId" type="xsd:long" minOccurs="0"
maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:long" />
<xsd:attribute name="dateOfExpiry" type="xsd:date" />
<xsd:attribute name="description" type="xsd:string" />
<xsd:attribute name="calorificValue" type="xsd:int" />
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="amount" type="xsd:float" />
<xsd:attribute name="amountUnit" type="xsd:string" />
<xsd:attribute name="fromTemperatureRange" type="xsd:float" />
<xsd:attribute name="toTemperatureRange" type="xsd:float" />
</xsd:complexType>
<xsd:element name="saveProductRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="product" type="common:product-type" minOccurs="0"
maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="saveProductResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="productId" type="xsd:long" minOccurs="0"
maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="message-type">
<xsd:attribute name="message" type="xsd:string" />
<xsd:attribute name="language">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="de_DE" />
<xsd:enumeration value="en_US" />
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
<xsd:element name="localizedMessage">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="message" type="common:message-type" minOccurs="0"
maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="saveProductResponse">
<wsdl:part name="saveProductResponse"
element="common:saveProductResponse"></wsdl:part>
</wsdl:message>
<wsdl:message name="saveProductRequest">
<wsdl:part name="saveProductRequest"
element="common:saveProductRequest"></wsdl:part>
</wsdl:message>
<wsdl:message name="categoryNotFound">
<wsdl:part name="categoryNotFound"
element="common:localizedMessage"></wsdl:part>
</wsdl:message>
<wsdl:portType name="CarePort">
<wsdl:operation name="saveProduct">
<wsdl:input message="ss:saveProductRequest"></wsdl:input>
<wsdl:output message="ss:saveProductResponse"></wsdl:output>
<wsdl:fault name="categoryNotFound"
message="ss:categoryNotFound"></wsdl:fault>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CareBindingSOAP" type="ss:CarePort">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<wsdl:operation name="saveProduct">
<soap:operation soapAction="http://haschemi.org/care/saveProduct"
style="document" />
<wsdl:input>
<soap:body parts="saveProductRequest" use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body parts="saveProductResponse" use="literal" />
</wsdl:output>
<wsdl:fault name="categoryNotFound">
<soap:fault name="categoryNotFound" use="literal" />
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="care">
<wsdl:port name="CareSOAP" binding="ss:CareBindingSOAP">
<soap:address location="http://haschemi.org:8080/axis2/services/care/" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>