Error processing web service request, java.lang.IllegalState
lipikamitra Apr 27, 2009 10:23 PM
Getting this error while calling a web service. The xsd is as follows:
<?xml version="1.0" encoding="UTF-8" ?> <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="shiporder"> <xs:complexType> <xs:sequence> <xs:element name="orderperson" type="xs:string"/> <xs:element name="shipto"> <xs:complexType> <xs:sequence> <xs:element name="name" type="xs:string"/> <xs:element name="address" type="xs:string"/> <xs:element name="city" type="xs:string"/> <xs:element name="country" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="item" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="title" type="xs:string"/> <xs:element name="note" type="xs:string" minOccurs="0"/> <xs:element name="quantity" type="xs:positiveInteger"/> <xs:element name="price" type="xs:decimal"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
The SOAP message is as follows:
<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://D:/jbossesb-server-4.5.GA/itertek/POC/POC-27Apr2009-XSD/shiporder.xsd"> <soap:Body> <shiporder> <orderperson>John Smith</orderperson> <shipto> <name>Ola Nordmann</name> <address>Langgt 23</address> <city>4000 Stavanger</city> <country>Norway</country> </shipto> <item> <title>Empire Burlesque</title> <note>Special Edition</note> <quantity>1</quantity> <price>10.90</price> </item> </shiporder> </soap:Body> </soap:Envelope>
However, it does work when using it with target name space, the xsd using target name space is:
<?xml version="1.0" encoding="ISO-8859-1" ?> <!--xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"--> <xs:schema version="1.0" targetNamespace="http://www.jboss.org/shiporder" xmlns:x1="http://www.jboss.org/shiporder" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="shiporder"> <xs:complexType> <xs:sequence> <xs:element name="orderperson" type="xs:string"/> <xs:element name="shipto"> <xs:complexType> <xs:sequence> <xs:element name="name" type="xs:string"/> <xs:element name="address" type="xs:string"/> <xs:element name="city" type="xs:string"/> <xs:element name="country" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="item" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="title" type="xs:string"/> <xs:element name="note" type="xs:string" minOccurs="0"/> <xs:element name="quantity" type="xs:positiveInteger"/> <xs:element name="price" type="xs:decimal"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
And, the SOAP message for the same is:
<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" xmlns:shiporder="http://www.jboss.org/shiporder"> <soap:Body> <shiporder:shiporder> <shiporder:orderperson>John Smith</shiporder:orderperson> <shiporder:shipto> <shiporder:name>Ola Nordmann</shiporder:name> <shiporder:address>Langgt 23</shiporder:address> <shiporder:city>4000 Stavanger</shiporder:city> <shiporder:country>Norway</shiporder:country> </shiporder:shipto> <shiporder:item> <shiporder:title>Empire Burlesque</shiporder:title> <shiporder:note>Special Edition</shiporder:note> <shiporder:quantity>1</shiporder:quantity> <shiporder:price>10.90</shiporder:price> </shiporder:item> </shiporder:shiporder> </soap:Body> </soap:Envelope>
Is it mandatory to use target name space with SOAP? Is it something to do with wrapping objects in a Namespace? How do i do that?
I tried chaning the SOAP message by specifying nonamespace location inside soab:body tag, but got this error:
SAXParseException: The value of the attribute "prefix="xmlns",localpart="ns1",rawname="xmlns:ns1"" is invalid. Prefixed namespace binding
s may not be empty
Any help would be highly appreciated!
Thanks!