I have developed a SOAP client using Xfire and JAXB to generate the
necessary types.



Here is the schema definition for an Update_AssetResponseElement:
<xs:schema targetNamespace="http://Update_AssetPackage/types/";>
        <xs:element name="Update_AssetResponseElement">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="result"
type="xs:string" minOccurs="1" maxOccurs="1"/>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>
</xs:schema>



Here is a sample SOAP response:
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:ns0="http://Update_AssetPackage/types/";><env:Body><ns0:Update_Asse
tResponseElement><ns0:result>&lt;?xml version = '1.0' encoding =
'UTF-8'?&gt;&lt;Update_Asset&gt;&lt;Asset_Code&gt;53484&lt;/Asset_Code&g
t;&lt;Asset_Name&gt;Asset
1&lt;/Asset_Name&gt;&lt;STATUS&gt;&lt;MESSAGE&gt;Update_Asset was
successful.&lt;/MESSAGE&gt;&lt;/STATUS&gt;&lt;/Update_Asset&gt;</ns0:res
ult></ns0:Update_AssetResponseElement></env:Body></env:Envelope>



Here is the snippet of code that invokes the service:
UpdateAssetResponseElement response =
updateAssetService.updateAsset(request);
String result = response.getResult();


The error occurs at the line which reads: String result =
response.getResult(); which tells me that something is wrong with the
response I am getting back. I did some unmarshalling tests on my own,
using a set String containing everything but the SOAP envelope and body.



String responseElement = "<ns0:Update_AssetResponseElement><ns0:result
xmlns:ns0='http://Update_AssetPackage/types/'>&lt;?xml version = '1.0'
encoding =
'UTF-8'?&gt;&lt;Update_Asset&gt;&lt;Asset_Code&gt;53484&lt;/Asset_Code&g
t;&lt;Asset_Name&gt;Asset
1&lt;/Asset_Name&gt;&lt;STATUS&gt;&lt;MESSAGE&gt;Update_Asset was
successful.&lt;/MESSAGE&gt;&lt;/STATUS&gt;&lt;/Update_Asset&gt;</ns0:res
ult></ns0:Update_AssetResponseElement>";


This string does not unmarshal correctly. I get an
UpdateAssetResponseElement object, but the result field within that is
null.

I took out the ns0 prefix from the result tag (because in the schema
used to generate the types, the result element is of type xs:string) in
the responseElement String, and it unmarshalled just fine. Is this issue
related to why Xfire is getting a null UpdateAssetResponseElement object
when invoking the service?

Thanks,
Steven Wu

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to