简体   繁体   中英

Generating java classes from wsdl

I have an wsdl, from it i generated server stubs using apache cxf. The problem is new wsdl which i deploy differs from initial one, so soap requests for old one do not work for the new one. I test it using soapUI. New ones have this weird namespace init :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:init="http://initiator.clientprovisioning_1_0.mdm.smarttrust.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <init:cpDiscovery.Response>

Old soap messages didnt had this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <cpDiscovery.Response>

I'll provide whatever additional info is needed. I've been trying to solve this for 2 days now. Please help.

EDIT this init prefix depends on first letters the java package. So for example if classes are in me.mycompany.example prefix is:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:exam="http://example.mycompany.net/">
   <soapenv:Header/>
   <soapenv:Body>
      <exam:cpDiscovery.Response>

EDIT http://cxf.apache.org/docs/developing-a-service.html#DevelopingaService-AnnotatingtheCode this states

targetNamespace property Specifies the target namespace under which the service is defined. If this property is not specified, the target namespace is derived from the package name.

how do i get rid of this?

You've introduced a namespace into the XML schema that describes your SOAP payload. This shouldn't affect a client's ability to invoke your service, as long as they can access the schema file.

The "old" soap message is actually invalid and likely should have never worked. Per the soap spec, children of the soap:Body MUST be namespace qualified. It looks like the "new" behavior is the one you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM