You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by davidgo <dg...@riafinancial.com> on 2010/11/02 18:20:24 UTC

generated request has incorrect namespaces.

I am consuming a webservice created in .NET.  So, the wsdl is generated from
that code.
I am using cxf 2.2.11 wsdl2java to create java classes for a client.
Once I have the client running it sends out a request that does not contain
the correct namespaces.
So, it gets a bad response.
The generated problem namespaces look like this:
xmlns:ns5="http://tempuri.org/" xmlns=""
The correct names should simply refer to an already defined namespace, such
as ns3:
The proper namespace for these items is: 
xmlns:ns3="http://schemas.datacontract.org/2004/07/net.PaymentService" 
The item that does have the correct name is an Integer
The item that does not have the correct name is a JAXBElement<String>
Throughout it is only with the JAXBElements that the problem is occuring.

Here is an example piece of what is generated:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
	<ValidateTransaction 
		xmlns="http://tempuri.org/" 
		xmlns:ns2="http://schemas.microsoft.com/2003/10/Serialization/Arrays" 
		xmlns:ns3="http://schemas.datacontract.org/2004/07/net.PaymentService" 
		xmlns:ns4="http://schemas.microsoft.com/2003/10/Serialization/">
	<acctInfo>
		<AccountNumber xmlns:ns5="http://tempuri.org/"
xmlns="">8220122040263427</AccountNumber>
		<ns3:BillerLocationID>370211</ns3:BillerLocationID>
	</acctInfo>
	<paymentProcessorID>0</paymentProcessorID>
	</ValidateTransaction>
</soap:Body>
</soap:Envelope>

Here is a request that works properly:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:tem="http://tempuri.org/" 
xmlns:eur="http://schemas.datacontract.org/2004/07/net.PaymentService" 
xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
   <soapenv:Header/>
   <soapenv:Body>
    <tem:ValidateTransaction>
         <tem:acctInfo>
            <eur:AccountNumber>8220122040263427</eur:AccountNumber>
            <eur:BillerLocationID>370211</eur:BillerLocationID>
         </tem:acctInfo>
         <tem:paymentProcessorID>0</tem:paymentProcessorID>
      </tem:ValidateTransaction>
   </soapenv:Body>
</soapenv:Envelope>

I have tried editing the generated classes to try to correct this, but
cannot seem to figure out the correct way to do it.

Thanks,
David
-- 
View this message in context: http://cxf.547215.n5.nabble.com/generated-request-has-incorrect-namespaces-tp3247088p3247088.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: generated request has incorrect namespaces.

Posted by eaudet <ea...@jarics.com>.
Hi, can you send an example of your binding file to remove the JAXBElement?

--
View this message in context: http://cxf.547215.n5.nabble.com/generated-request-has-incorrect-namespaces-tp3247088p3423990.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: generated request has incorrect namespaces.

Posted by davidgo <dg...@riafinancial.com>.
I found a solution to this issue.

I saw the solution in a different problem:  Someone wanted to get rid of the
JAXBElements in the generated code so they did not have to handle them.
Since my problem only happened with the JAXBElements, I decided this
solution might help me as well.
So, I used a binding when generating my classes to accomplish this:

<jaxb:globalBindings generateElementProperty="false"/> 

Now the request gets the correct namespaces for all the fields.
-David

-- 
View this message in context: http://cxf.547215.n5.nabble.com/generated-request-has-incorrect-namespaces-tp3247088p3247678.html
Sent from the cxf-user mailing list archive at Nabble.com.