I converted the WSDL classes to Java, however I needed to use a binding file and suffix to resolve conflicts. I got the classes successfully, but with slightly changed type names. When I try to create a WebService using a JaxWsProxyFactoryBean, then I put the URL of the WSDL source that has the origin names and it gives errors like this:
ERROR 6792 --- [nio-5500-exec-1] oacwsfReflectionServiceFactoryBean: schema element { http://tempuri.org/ } Links SearchMagistratesCourtRequest undefined type SearchMagistratesCourtRequest for service { http://tempuri.org/ } WebServiceService.
And this is correct, because my generated class has the name "SearchMagistratesCourtRequestType" - with "Type" at the end.
So my bind file used the following setting:
<jaxb:bindings schemaLocation="../xsd/egrul.xsd">
<jaxb:schemaBindings>
<jaxb:package name="ru.spi2.javaee.custom.pravoru.classes.egrul"/>
<jaxb:nameXmlTransform>
<jaxb:typeName suffix="Type"/>
<jaxb:elementName suffix="Element"/> //this one is not needed actually
</jaxb:nameXmlTransform>
</jaxb:schemaBindings>
</jaxb:bindings>
The suffix was used here.
I create my WebService as follows:
JaxWsProxyFactoryBean portFactory = new JaxWsProxyFactoryBean();
portFactory.setAddress(WSDL_URL);
portFactory.setServiceClass(WebService.class);
webService = (WebService) portFactory.create();
Here I put the start of WSDL_URL and get the errors described.
How can I take into account the binding setting that was used to generate the Java classes here? Or what could be the solution?
source
share