Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-3613

SOAP message contains prefix axis2ns1 for every element when converting using JAXB generated code

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 1.5
    • None
    • None
    • Using Axis2 with JAXB2.1.6 generated source on JBOSS 4.2.2 app server

    Description

      Am new to this forum, if i have not put this at the correct place then please let me know.

      I have have build the skeleton for the webservice using Axis2.

      The webservice an Output element as ANY which is defined by an XML schema. The XML schema is not part of WSDL. This element is built from the classes generated from JAXB 2.1.6. After polulating the JAVA objects generated I am able to get the XML document on the console(have the source and result listed below). But when I generate the Soap/OMElement from the Java objects I am getting for all XML element a prefix of 'axis2ns1'. How can avoid the prefix axis2ns1: in my soap response ?

      <axis2ns1:agreements xmlns:axis2ns1="http://sync.ws.awg.aon.com/PolicyVerificationSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <axis2ns1:agreement>
      <axis2ns1:agmtSeqNumber>0</axis2ns1:agmtSeqNumber>
      <axis2ns1:agmtHolderInfo>
      <axis2ns1:firstName>Josephine</axis2ns1:firstName>
      <axis2ns1:lastName>Mascarenhas</axis2ns1:lastName>
      </axis2ns1:agmtHolderInfo>
      <axis2ns1:warrantyTermMonths>0</axis2ns1:warrantyTermMonths>
      <axis2ns1:warrantyTermMiles>0</axis2ns1:warrantyTermMiles>
      <axis2ns1:mileageExpiration>0</axis2ns1:mileageExpiration>
      <axis2ns1:odometerAtPurchase>0</axis2ns1:odometerAtPurchase>
      <axis2ns1:rentalAmtAllowed>0</axis2ns1:rentalAmtAllowed>
      <axis2ns1:rentalDays>0</axis2ns1:rentalDays>
      <axis2ns1:towAmtLimit>0</axis2ns1:towAmtLimit>
      <axis2ns1:stdDeductibleAmt>0</axis2ns1:stdDeductibleAmt>
      <axis2ns1:discDeductibleAmt>0</axis2ns1:discDeductibleAmt>
      <axis2ns1:requestID>0</axis2ns1:requestID>
      </axis2ns1:agreement>
      </axis2ns1:agreements>

      Method used to build above is -->

      public OMElement javaObjsToSoap(Object obj) throws JAXBException,
      SOAPException

      { SAXOMBuilder builder = new SAXOMBuilder(); marshaller.marshal(obj, builder); OMElement parent = builder.getRootElement(); return parent; }

      marshaller object is created using -->
      JAXBContext jc = JAXBContext.newInstance("com.twg.jaxbobjs");
      // crate a Marshaller
      marshaller = jc.createMarshaller();

      When I use following method I get the out on System.out as -->
      public void javaObjsToConsole(Object obj) throws JAXBException {
      marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
      marshaller.marshal(obj, System.out);
      }

      output on system.ou as -->
      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <agreements xmlns="http://sync.ws.awg.aon.com/PolicyVerificationSchema">
      <agreement>
      <agmtSeqNumber>0</agmtSeqNumber>
      <agmtHolderInfo>
      <firstName>Josephine</firstName>
      <lastName>Mascarenhas</lastName>
      </agmtHolderInfo>
      <warrantyTermMonths>0</warrantyTermMonths>
      <warrantyTermMiles>0</warrantyTermMiles>
      <mileageExpiration>0</mileageExpiration>
      <odometerAtPurchase>0</odometerAtPurchase>
      <rentalAmtAllowed>0</rentalAmtAllowed>
      <rentalDays>0</rentalDays>
      <towAmtLimit>0</towAmtLimit>
      <stdDeductibleAmt>0</stdDeductibleAmt>
      <discDeductibleAmt>0</discDeductibleAmt>
      <requestID>0</requestID>
      </agreement>
      </agreements>

      Hope to hear from someone. Any help will be greatly appreciated.

      Attachments

        Issue Links

          Activity

            People

              veithen Andreas Veithen
              mascarenhasl Leo Mascarenhas
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: