[ https://issues.apache.org/jira/browse/AXIS2-3613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12661039#action_12661039 ]
Doug Guzek commented on AXIS2-3613: ----------------------------------- I am hoping that someone would provide a solution to this problem. Why is the default namespace getting set to "axis2ns1" and is there anyway to have no Namespace prefix? > SOAP message contains prefix axis2ns1 for every element when converting > using JAXB generated code > -------------------------------------------------------------------------------------------------- > > Key: AXIS2-3613 > URL: https://issues.apache.org/jira/browse/AXIS2-3613 > Project: Axis 2.0 (Axis2) > Issue Type: Bug > Environment: Using Axis2 with JAXB2.1.6 generated source on JBOSS > 4.2.2 app server > Reporter: Leo Mascarenhas > Priority: Minor > > 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. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.