cancel
Showing results for 
Search instead for 
Did you mean: 

Set the Value to the Web Service field eg. JAXBElement<String>

Former Member
0 Kudos

Hi Experts,

I have WSDL file.I have import the WSDL file in EJB Application.

After that i have created the Generate Client for that WSDL file.

Once after create the Generate Client file i got the Java Calsses.

By using the i have execute the WSDL.During the Client coding i have struct in the below explaind part.

In that JAVA Classes all the values are created as JAXBElement type.

So i am not able set the value for that type.ex JAXBElement<String>.

Please explain how to set the value for JAXBElement<String>.

Please do the needful.Its really urgent.

Thanks & Regards,

SatheshKumar R

Accepted Solutions (0)

Answers (1)

Answers (1)

steffen_spahr2
Participant
0 Kudos

Hi,

the solution (Thanks to Elena from SAP) for your requirement is using customization files.

With customization file can be defined elements mappings to the specific types instead to JAXBElement.

For example:

This will be generated without customization file:

@XmlElementRef(name = "fahrzeugart", namespace = "urn:de.msg.evb.dto",

                          type = JAXBElement.class)

                          protectedJAXBElement<Short> fahrzeugart;

And this is the output with customization:

@XmlElement(nillable = true)

protectedShort fahrzeugart;

Use this customization file:

<?xml version="1.0" encoding="UTF-8"?>

<jaxws:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"

                        xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"

                        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

                        xmlns:xs="http://www.w3.org/2001/XMLSchema"

                        wsdlLocation="Default_EvbServicesVi_document.wsdl">

  <jaxws:bindings node="wsdl:definitions/wsdl:types             /xs:schema[@targetNamespace='urn:de.msg.evb.dto']">

    <jaxb:globalBindings generateElementProperty="false" mapSimpleTypeDef="true"/>

  </jaxws:bindings>

</jaxws:bindings>

in the second step of the wizard by choosing "Specify JAX-WS Customization Files" and add the customization-file.

(Rem.: Look at the correct pathes! I placed the customizing file below the porttypes-folder where the

Default_EvbServicesVi_document.wsdl lies.)

More information about that specific customization you can find here:

https://metro.java.net/nonav/1.2/guide/Customizations_for_WCF_Service_WSDL.html

Regards

Steffen