"NullPointerException" is being thrown when I tried to call 
class Call's invoke method by passing in the SOAPEnvelope.

The Soap Envelope looks like,

<SOAP-ENV:Envelope 
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; 
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>

<SOAP-ENV:Body>
        <CreatePurchaseOrder xmlns="urn:PO" 
                xmlns:ns1="http://tempuri.org"; 
                xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>

                <ns1:Description>my purchase order</ns1:Description>
                <ns1:POID>1020</ns1:POID>
                <ns1:Submitter>Susan</ns1:Submitter>
                <ns1:OrderDate/>
                <ns1:ShipTo>
                <ns1:StreetName>222 west ridge dr</ns1:StreetName>
                <ns1:ZipCode>89675</ns1:ZipCode>
                <ns1:PhoneNumber>650-987-4537</ns1:PhoneNumber>
                <ns1:EmailID/>
                </ns1:ShipTo>
                <ns1:BillTo>
                <ns1:StreetName>2314 Colorodo sve</ns1:StreetName>
                <ns1:ZipCode>47784</ns1:ZipCode>
                <ns1:PhoneNumber/>
                <ns1:EmailID>sue.remedy.com</ns1:EmailID>
                </ns1:BillTo>
                <ns1:LineItem>
                <ns1:ItemName>pencil</ns1:ItemName>
                <ns1:Quantity>20</ns1:Quantity>
                <ns1:ItemID>120</ns1:ItemID>
                </ns1:LineItem>
        </CreatePurchaseOrder> 
</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

But when I removed the namespace ns1 and ns1: from all the elements 
or added the namespace inside each element declaration like the one 
mentioned below, it works. 

I am using Axis Beta2. 
Atleast it should throw a proper message instead of null pointer exception.

<soap:Envelope 
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"; 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
        xmlns:xsd="http://www.w3.org/2001/XMLSchema";>

<soap:Body>
    <CreatePurchaseOrder xmlns="urn:PO">
        <Description xmlns="http://tempuri.org";>gdfdg</Description>
        <POID xmlns="http://tempuri.org";>44</POID>
        <Submitter xmlns="http://tempuri.org";>ffff</Submitter>
        <OrderDate xmlns="http://tempuri.org";>2002-07-24</OrderDate>
        <ShipTo xmlns="http://tempuri.org";>
                        <StreetName>ttt</StreetName>
                        <ZipCode>77777</ZipCode>
                        <PhoneNumber>456-898-6766</PhoneNumber>
                        <EmailID />
        </ShipTo>
        <BillTo xmlns="http://tempuri.org";>
                        <StreetName>dfg5 reg</StreetName>
                        <ZipCode>6755</ZipCode>
                        <PhoneNumber>456-777-8888</PhoneNumber>
                        <EmailID />
        </BillTo>
        <LineItem xmlns="http://tempuri.org";>
                        <ItemName>tin</ItemName>
                        <Quantity>44</Quantity>
                        <ItemID>1022</ItemID>
        </LineItem>
    </CreatePurchaseOrder>
</soap:Body>

</soap:Envelope>

Here is the stack trace..

java.lang.NullPointerException
        at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.
java:134)
        at
org.apache.axis.encoding.DeserializationContextImpl.endElement(Deseri
alizationContextImpl.java:875)
        at
org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXPar
ser.java:568)
        at
org.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(XMLNamespa
ceBinder.java:853)
        at
org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBind
er.java:643)
        at
org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDVal
idator.java:3006)
        at
org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator
.java:930)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.handleEndElemen
t(XMLDocumentFragmentScannerImpl.java:1145)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(
XMLDocumentFragmentScannerImpl.java:988)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1446)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XM
LDocumentFragmentScannerImpl.java:333)
        at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardP
arserConfiguration.java:525)
        at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardP
arserConfiguration.java:581)
        at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
        at
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.j
ava:1157)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:394)
        at
org.apache.axis.encoding.DeserializationContextImpl.parse(Deserializa
tionContextImpl.java:202)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:428)
        at org.apache.axis.client.Call.invoke(Call.java:1919)
        at org.apache.axis.client.Call.invoke(Call.java:1224)
        at WebServiceSoapClient.call(WebServiceSoapClient.java:170)

Thank you,
Nirmala

Reply via email to