Error passing Element to web service

C

chrsty_a

I'm upgrading from WebLogic 6.1 to WebLogic 8.1 SP 4.

We used to specify weblogic.soap.http.SoapInitialContextFactory and
weblogic.soap.encoding.factory to lookup the web service in the client.
Well, the SoapInitialContextFactory and CodecFactory classes are no
longer around. So now I've used clientgen to generate the stubs and
here is my client code:

MyWebService service = new MyWebService_Impl(wsdlurl);
MyWebServicePort port = service.getMyWebServicePort();
Element result = port.processIt(theElement);

However, I get the following error calling processIt:

java.rmi.RemoteException: web service invoke failed:
javax.xml.soap.SOAPException: failed to serialize interface
org.w3c.dom.Element weblogic.xml.schema.binding.SerializationException:
Failed to serialize Document due to the following error
weblogic.xml.stream.XMLStreamException: The local name of an attribute
cannot be null
....
Caused by: weblogic.xml.schema.binding.SerializationException: Failed
to serialize Document due to the following error
weblogic.xml.stream.XMLStreamException: The local name of an attribute
cannot be null
at
weblogic.xml.schema.binding.internal.builtin.DocumentCodec.serialize(DocumentCodec.java:76)
...

Here's the schema and xml file:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://myproject.org/myproject_test.xsd"
xmlns:myproject_test="http://myproject.org/myproject_test.xsd"
elementFormDefault="qualified">
<element name="TEST">
<complexType>
<sequence>
<element ref="TEST_ID"/>
</sequence>
</complexType>
</element>
</complexType>
<element name="TEST_ID" type="string"/>
</schema>

<?xml version="1.0" encoding="UTF-8"?>
<TEST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://myproject_test.xsd"
xsi:schemaLocation="http://myproject.org/myproject_test.xsd"
file:///N:/myproject/metadata/myproject_test.xsd">
<TEST_ID>ABCD1234</TEST_ID>
</TEST>

I've been testing with this bare minimum schema so that I can change
the namespaces and other things easily. The one and only thing that's
made a difference is when I take out the namespace stuff from the xml
file, it does get sent to the server. I.E.:

<?xml version="1.0" encoding="UTF-8"?>
<TEST>
<TEST_ID>ABCD1234</TEST_ID>
</TEST>

However, I can't leave it like that because the server doesn't know
what to do with it. Also, when the server tries to send the response,
it gets the same error as above.

weblogic.xml.stream.XMLStreamException: The local name of an attribute
cannot be null
at
weblogic.xml.babel.adapters.DOMAdapter.adaptAttribute(DOMAdapter.java:113)
at
weblogic.xml.babel.adapters.DOMAdapter.adaptElement(DOMAdapter.java:147)
...

javax.xml.soap.SOAPException: failed to serialize interface
org.w3c.dom.Element weblogic.xml.schema.binding.SerializationException:
Failed to serialize Document due to the following error
weblogic.xml.stream.XMLStreamException: The local name of an attribute
cannot be null

The web service also returns an Element, but it's a different type from
a different schema, which I haven't touched. So the server is having
the same problem as the client.

If I change the web service to receive and return only strings, it
works fine. But I haven't been able to figure out why it won't work
for the Element. Does this sound like a problem with my WebLogic
configuration, the schemas/xml files, the web service, the client? Is
there a way to tell what attribute it is complaining about?

Thanks,
Christy
 
Joined
May 12, 2008
Messages
1
Reaction score
0
i got the same error.
I rectified by

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);

when Iam building the reply document. I think the setNamespaceAware attribute should be set to true.
better luck
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,152
Latest member
LorettaGur
Top