At 05:57 PM 3/18/2004, Hari Lakshmanan wrote:
Hi Anne,
The name space in the SOAP envelop works as you had described. However I am still having problem and my guess is it has to-do with the MapSerializer and BeanSerializer (I use Doc/literal web service). When I add a complex type to hashMap, the value element has two children instead of one and this is causing the problem. I am using the MapSerializer(shipped with Axis) for HashMap and BeanSerializer (shipped with Axis) for complext type (CourseBO).
Is there a problem in using Mapserializer and BeanSerializer with doc / literal web service style? Please note that everything works when I use RPC/Encoded style (due to multiref object serialization) or am I missing something in my WSDL file? Here is my WSDL file
Hope this is not too much of trouble.
__Hari
Do you Yahoo!?
- -----Original Message-----
- From: Anne Thomas Manes [mailto:[EMAIL PROTECTED]]
- Sent: Thursday, March 18, 2004 6:35 AM
- To: [EMAIL PROTECTED]
- Subject: RE: SimpleDeserializer encountered a child element, which is NOT expected
- Hari,
- If an element is defined as a local element within a schema (i.e., it is defined within a type definition rather than as a direct child of the <schema> element), and if you have not specified elementFormDefault="qualified" in the schema, then the element MUST NOT be namespace qualified in a schema instance.
- If a document instance declares a default namespace, then each unqualified local element must include the xmlns="" attribute in order to specify no namespace.
- For example, if you have a schema such as:
- <schema xmlns=".../XMLSchema" targetNamespace="urn:foobar" xmlns:tns="urn:foobar">
- <complexType name="foobar">
- <sequence>
- <element name="foo" type="string"/>
- <element name="bar" type="string"/>
- </sequence>
- </complexType>
- <element name="foobar" type="tns:foobar"/>
- </schema>
- The element "foobar" and the complexType "foobar" are global, but the elements "foo" and "bar" are local. In a valid document instance, "foobar" must be namespace qualified, but "foo" and "bar" must not be.
- So this instance would be valid:
- <tns:foobar xmlns:tns="urn:foobar">
- <foo>foo</foo>
- <bar>bar</bar>
- </tns:foobar>
- But this instance would not be valid:
- <foobar xmlns="urn:foobar">
- <foo>foo</foo>
- <bar>bar</bar>
- </foobar>
- If you define a default namespace for <foobar>, then you must override that namespace declaration for each local child element to make it valid:
- <foobar xmlns="urn:foobar">
- <foo xmlns="">foo</foo>
- <bar xmlns="">bar</bar>
- </tns:foobar>
- Note that if you set elementFormDefault to "qualified" then all local elements must then be namespace qualified:
- <schema xmlns=".../XMLSchema" targetNamespace="urn:foobar" xmlns:tns="urn:foobar"
- elementFormDefault="qualified">
- <complexType name="foobar">
- <sequence>
- <element name="foo" type="string"/>
- <element name="bar" type="string"/>
- </sequence>
- </complexType>
- <element name="foobar" type="tns:foobar"/>
- </schema>
- With this schema the following document instance would be invalid:
- <tns:foobar xmlns:tns="urn:foobar">
- <foo>foo</foo>
- <bar>bar</bar>
- </tns:foobar>
- While the following instances would be valid:
- <tns:foobar xmlns:tns="urn:foobar">
- <tns:foo>foo</tns:foo>
- <tns:bar>bar</tns:bar>
- </tns:foobar>
- <foobar xmlns="urn:foobar">
- <foo>foo</foo>
- <bar>bar</bar>
- </foobar>
- Regards,
- Anne
- At 12:09 AM 3/18/2004, you wrote:
- This is not directly related to the discussion on hand. But I have been trying to get around this problem in axis.
- If you notice the element
- <processName xmlns="">CourseBusinessProcess</processName>
- why should the message have a namespace xmlns="" Is it right to have this for elements.
- What is the significance of this element.
- Any pointers will be helpful
- Vijay
- P.S - I am sort of a newbie in axis.
- Hari Lakshmanan <[EMAIL PROTECTED]> wrote:
- I get the same error and it happens only in a particular scenario. I have a class like this
- public class BPEvent {
- private String processName;
- private HashMap attributes;
- ...
- ...
- }
- When I add a String object to atts everythign works fine. However when I add my customized type, I get this error. The SOAP message looks like this
- <soapenv:Body>
- <in0 xmlns="urn:typeNS">
- <processName xmlns="">CourseBusinessProcess</processName>
- <attributes xmlns="">
- <item xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://xml.apache.org/xml-soap">
- <key>Operation</key>
- <value>Save</value>
- </item>
- <item>
- <key>COURSEBO</key>
- <value>
- <ID>0</ID>
- <name xsi:nil="true"/>
- </value>
- </item>
- </attributes>
- </in0>
- </soapenv:Body>
- In the above the Item COURSEBO is my customized type and note the way the value element is being formed. My guess is this is causing the above exception.
- is this a known issue with Map serializer and de-serializer? If so are there any workarounds?
- Thanks
- __Hari
- -----Original Message-----
- From: Nick Sharples [mailto:[EMAIL PROTECTED]]
- Sent: Wednesday, March 17, 2004 1:04 PM
- To: [EMAIL PROTECTED]
- Subject: RE: SimpleDeserializer encountered a child element, which is NOT expected
- P.S. The same error occurs when I set my XML parser to be Xerces in stead of Crimson
- -----Original Message-----
- From: Nick Sharples [mailto:[EMAIL PROTECTED]]
- Sent: 17 March 2004 21:02
- To: [EMAIL PROTECTED]
- Subject: SimpleDeserializer encountered a child element, which is NOT expected
- Hello All,
- Has anybody seen this message before?
- I wouldn't be so confused if this error was consistent, but it only occurs when I try to run the my JUnit test cases and NOT when I run my client application.
- I've checked for differences in the classpaths for the two apps and the only difference I can notice is that when I run the tests is that I have junit.jar in my classpath.
- The complete axis fault trace looks like this:
- =============================================
- org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
- AxisFault
- faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
- faultSubcode:
- faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
- faultActor:
- faultNode:
- faultDetail:
- {http://xml.apache.org/axis/}stackTrace: AxisFault
- faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
- faultSubcode:
- faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
- faultActor:
- faultNode:
- faultDetail:
- org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
- at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:260)
- at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169)
- at org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:1015)
- at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1675)
- at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
- at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
- at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
- at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
- at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:634)
- at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)
- at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
- at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
- at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:242)
- at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
- at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
- at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
- at org.apache.axis.client.Call.invoke(Call.java:2553)
- at org.apache.axis.client.Call.invoke(Call.java:2248)
- at org.apache.axis.client.Call.invoke(Call.java:2171)
- at org.apache.axis.client.Call.invoke(Call.java:1691)
- at xx.xx.xx.GroupManagementServiceSyncSoapStub.createGroup(GroupManagementServiceSyncSoapStub.java:742)
- at xx.xx.xx.GroupManagementServiceSyncTestCase.test1GroupManagementServiceSyncSoapCreateGroup(GroupManagementServiceSyncTestCase.java:41)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- =============================================
Yahoo! Mail - More reliable, more storage, less spam
~~~~~~~~~~~~~~~~~~
Anne Thomas Manes
VP & Research Director
Burton Group
Anne Thomas Manes
VP & Research Director
Burton Group