From: [email protected] [mailto:[email protected]] On Behalf Of Scott Kurz
Sent: Monday, November 28, 2011 6:46 AM
To: [email protected]
Subject: Re: Wrong result type in web service operation

Hi Sebastian,

Sorry, didn't get a chance to look at your test before taking a few days 
vacation.

I think your JAXB tweaks may be the problem.

You didn't seem to include the generated ObjectFactory.class and 
package-info.class files.    Since that's where the package level 
info/annotations are stored, I'm guessing that's why your Java isn't getting 
serialized to XML correctly.  (Basically JAXB maps between a schema 
targetNamespace and a Java package).

Also, I can't recall when you can use a constructor to instantiate a JAXB 
object (or even if you ever can), but typically ObjectFactory.createXXX methods 
are used, instead of constructors.

You mentioned tweaking to add java.io.Serializable support.    Did you know 
that the wsimport and xjc tools give you a way to add that into the generated 
code by customizing the WSDL/XSD?
[snip]
Scott


Hello Scott,

thank you very much for your taking so much trouble.

My mistake has been not to include the package-info file. Once I did that, it 
worked.
So now I can use the bare parameter styles with SAP web services – thanks again.

Two notes:

·         The use of new instead of ObjectFactory is unproblematic in this 
case, but I’d better use the factory in the future.

·         I couldn’t get the WSDL annotation to work for serialization. 
However, it works when I use a separate bindings.xml (see attached file) with 
the –b command-line option for wsimport. (Only drawback is that every class has 
the same serialVersionUID)


n  Sebastian

IDS Scheer Consulting GmbH
Geschäftsführer/Managing Directors: Kamyar Niroumand, Ivo Totev
Sitz/Registered office: Altenkesseler Straße 17, 66115 Saarbrücken, Germany - 
Registergericht/Commercial register: Saarbrücken HRB 19681
http://www.softwareag.com

<?xml version="1.0" encoding="UTF-8"?>
<bindings xmlns="http://java.sun.com/xml/ns/jaxb"; xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance";
	xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc";
	xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd";
	version="2.1">
	<globalBindings>
		<serializable uid="1" />
	</globalBindings>
</bindings>

Reply via email to