Note that there are some explanatory texts on larger screens.

plurals
  1. POAnt task to convert WSDL to POJO with the use of XJC gives an Error package name
    primarykey
    data
    text
    <p>I have an Ant task that takes a wsdl file and should auto generate POJO's (client side Java) , so I can start programming my client side JAX-WS web services.</p> <p>However I'm getting an error "[ERROR] The package name .... used for this schema is not a valid package name"</p> <p>This error only occurs when my <em>wsdl</em> file has more than 1 schema import in it such as</p> <pre><code> &lt;xsd:import namespace="http://service.rts.cmslink.tms.com/ProcessCustomerInquiry/Response" schemaLocation="ProcessCustomerInquiryResponse.xsd"/&gt; &lt;xsd:import namespace="http://service.rts.cmslink.tms.com/ProcessCustomerInquiry/Request" schemaLocation="ProcessCustomerInquiryRequest.xsd"/&gt; &lt;/xsd:schema&gt; </code></pre> <p>Below is the entire wsdl</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;wsdl:definitions xmlns:CMSLINK="http://service.rts.cmslink.tms.com/ProcessCustomerInquiry" xmlns:REQ="http://service.rts.cmslink.tms.com/ProcessCustomerInquiry/Request" xmlns:RESP="http://service.rts.cmslink.tms.com/ProcessCustomerInquiry/Response" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://service.rts.cmslink.tms.com/ProcessCustomerInquiry" name="ProcessCustomerInquiryService"&gt; &lt;wsdl:types&gt; &lt;xsd:schema&gt; &lt;xsd:import namespace="http://service.rts.cmslink.tms.com/ProcessCustomerInquiry/Response" schemaLocation="ProcessCustomerInquiryResponse.xsd"/&gt; &lt;xsd:import namespace="http://service.rts.cmslink.tms.com/ProcessCustomerInquiry/Request" schemaLocation="ProcessCustomerInquiryRequest.xsd"/&gt; &lt;/xsd:schema&gt; &lt;/wsdl:types&gt; &lt;wsdl:message name="ProcessCustomerInquiryRequest"&gt; &lt;wsdl:part name="requestData" element="REQ:ProcessCustomerInquiryRequest"/&gt; &lt;/wsdl:message&gt; &lt;wsdl:message name="ProcessCustomerInquiryResponse"&gt; &lt;wsdl:part name="responseData" element="RESP:ProcessCustomerInquiryResponse"/&gt; &lt;/wsdl:message&gt; &lt;wsdl:portType name="ESB_ProcessCustomerInquiryService"&gt; &lt;wsdl:operation name="ReqResp"&gt; &lt;wsdl:input name="processRequest" message="CMSLINK:ProcessCustomerInquiryRequest"/&gt; &lt;wsdl:output name="processResponse" message="CMSLINK:ProcessCustomerInquiryResponse"/&gt; &lt;/wsdl:operation&gt; &lt;/wsdl:portType&gt; &lt;wsdl:binding name="ProcessCustomerInquiryServiceSoapBinding" type="CMSLINK:ESB_ProcessCustomerInquiryService"&gt; &lt;wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/&gt; &lt;wsdl:operation name="ReqResp"&gt; &lt;wsdlsoap:operation soapAction="process"/&gt; &lt;wsdl:input&gt; &lt;wsdlsoap:body use="literal"/&gt; &lt;/wsdl:input&gt; &lt;wsdl:output&gt; &lt;wsdlsoap:body use="literal"/&gt; &lt;/wsdl:output&gt; &lt;/wsdl:operation&gt; &lt;/wsdl:binding&gt; &lt;wsdl:service name="ProcessCustomerInquiryService"&gt; &lt;wsdl:port name="ProcessCustomerInquiry" binding="CMSLINK:ProcessCustomerInquiryServiceSoapBinding"&gt; &lt;wsdlsoap:address location="http://tsesbd01.tms.toyota.com:51180/v2/MF_CMSLINK_ProcessCustomerInquiryDistributed.msgflow"/&gt; &lt;/wsdl:port&gt; &lt;/wsdl:service&gt; &lt;/wsdl:definitions&gt; </code></pre> <hr> <p>The XJC Ant task</p> <pre><code>&lt;project name="WSDLCompile" default="wsdl2java" basedir="."&gt; &lt;target name="wsdl2java" description="Run xjc -wsdl."&gt; &lt;!-- properties --&gt; &lt;property name="sourceDir" value="temp/src" /&gt; &lt;echo message="sourceDir:"/&gt; &lt;echo message="${sourceDir}"/&gt; &lt;mkdir dir="temp/classes"/&gt; &lt;property name="outputDir" value="temp/classes" /&gt; &lt;echo message="outputDir:"/&gt; &lt;echo message="${outputDir}"/&gt; &lt;!-- xjc properties --&gt; &lt;property name="wsdl.url" value="src/wsdl/cmslink/ProcessCustomerInquiry.wsdl" /&gt; &lt;echo message="wsdl.url:"/&gt; &lt;echo message="${wsdl.url}"/&gt; &lt;property name="wsdl.mapping.package.response" value="http://service.rts.cmslink.tms.com/ProcessCustomerInquiry/Response=com.tms.cmslink.rts.service.ProcessCustomerInquiry.Response" /&gt; &lt;echo message="wsdl.mapping.package.response:"/&gt; &lt;property name="wsdl.mapping.package.request" value="http://service.rts.cmslink.tms.com/ProcessCustomerInquiry/Request=com.tms.cmslink.rts.service.ProcessCustomerInquiry.Request" /&gt; &lt;echo message="wsdl.mapping.package.request:"/&gt; &lt;!--C:/Program Files/Java/jdk1.7.0_09/bin/xjc --&gt; &lt;!--xjc execution--&gt; &lt;exec executable="xjc"&gt; &lt;arg value="-wsdl" /&gt; &lt;arg value="${wsdl.url}" /&gt; &lt;arg value="-d" /&gt; &lt;arg value="${outputDir}" /&gt; &lt;arg value="-p"/&gt; &lt;arg value="${wsdl.mapping.package.request}"/&gt; &lt;arg value="-p"/&gt; &lt;arg value="${wsdl.mapping.package.response}"/&gt; &lt;arg value="-verbose"/&gt; &lt;/exec&gt; &lt;/target&gt; &lt;/project&gt; </code></pre> <p>If I remove the extra schema import either <em>response.xsd</em> or <em>request.xsd</em>, and also only include 1 "-p" package namespace argument for the ANT task, than the ANT runs without error, however my wsdl file contains multiple schema imports.</p> <p><strong>EDIT</strong></p> <p>I changed the value of "-p" arguement to adhere to package conventions, although my previous approach was based on JXC bug forum. </p> <pre><code>&lt;project name="WSDLCompile" default="wsdl2java" basedir="."&gt; &lt;target name="wsdl2java" description="Run xjc -wsdl."&gt; &lt;!-- properties --&gt; &lt;property name="sourceDir" value="temp/src" /&gt; &lt;echo message="sourceDir:"/&gt; &lt;echo message="${sourceDir}"/&gt; &lt;mkdir dir="temp/classes"/&gt; &lt;property name="outputDir" value="temp/classes" /&gt; &lt;echo message="outputDir:"/&gt; &lt;echo message="${outputDir}"/&gt; &lt;!-- xjc properties --&gt; &lt;property name="wsdl.url" value="src/wsdl/cmslink/ProcessCustomerInquiry.wsdl" /&gt; &lt;echo message="wsdl.url:"/&gt; &lt;echo message="${wsdl.url}"/&gt; &lt;property name="wsdl.mapping.package.response" value="com.tms.cmslink.rts.service.ProcessCustomerInquiry.Response" /&gt; &lt;echo message="wsdl.mapping.package.response:"/&gt; &lt;property name="wsdl.mapping.package.request" value="com.tms.cmslink.rts.service.ProcessCustomerInquiry.Request" /&gt; &lt;echo message="wsdl.mapping.package.request:"/&gt; &lt;!--C:/Program Files/Java/jdk1.7.0_09/bin/xjc --&gt; &lt;!--xjc execution--&gt; &lt;exec executable="xjc"&gt; &lt;arg value="-wsdl" /&gt; &lt;arg value="${wsdl.url}" /&gt; &lt;arg value="-d" /&gt; &lt;arg value="${outputDir}" /&gt; &lt;arg value="-p"/&gt; &lt;arg value="${wsdl.mapping.package.request}"/&gt; &lt;arg value="-p"/&gt; &lt;arg value="${wsdl.mapping.package.response}"/&gt; &lt;arg value="-verbose"/&gt; &lt;/exec&gt; &lt;/target&gt; &lt;/project&gt; </code></pre> <p>I have even tried the above ant task,with</p> <pre><code>-p &lt;arg value="${wsdl.mapping.package.request }"/&gt; &lt;arg value="${wsdl.mapping.package.response}"/&gt; </code></pre> <p>by putting both package names on 1 line separated by space, this is according to JXC doc , explaining you can have "zero or more package namespaces separated by space". I require XJC to be able to handle more than 1 schema import.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload