wsimport - Two declarations cause a collision in the ObjectFactory class - web-services

Trying to use wsimport to generate a client for a SOAP endpoint. wsdl was published by one of our clients. I am getting the below error when I am using wsimport or cxf , if I am using Axis2 the binding are generated properly.
Could anyone please offer any advice for how to get this to work?
Command Used :
wsimport -s src -d bin wsdlurl
Error:
parsing WSDL...
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 1 of wsdlurl?xsd=xsd4
[wsimport] [WARNING] unknown extensibility element or attribute "EndpointReference" (in namespace "http://www.w3.org/2005/08/addressing")

The Error is due to improper xsd formation in wsdl.
I have used NetBeans to generate the Webservice client .
When we try to generate the client Bindings it will give error, we need to change
the xsd files located in NetBeans Project
\NetBeansProject\src\META-INF\wsdl\packgestructure\wcflib-tc
and copy them to xmlresources path
\NetBeansProject\xml-resources\web-service-references\service\wsdl\packagestructure\wcflib-tc\ Folder and Refresh the service in project NetBeans client binding will be generated.

Related

Cannot compile Gsoap 2.8.123 using WS-Security on c++

I want use messages in http://www.onvif.org/ver10/advancedsecurity/wsdl/advancedsecurity.wsdl
From cmd prompt I run Wsdl2h and soapcpp2, they generate the cpp files that I included in my project.
Then I compile my project following those instruction:
https://www.genivia.com/examples/onvif/index.html (Using WS-Security)
The project is not built I've 657 errors in wsseapi.cpp:
it doesn't recognize wsse__Security in struct soap inside soap file wsseapi.cpp
Has someone faced this problem?
I tried to disable SSL security and the project is built with no error, but I need enable SSL using WS-Security.
I'm expecting that there are some configuration in soap to manage this situation.

Stub client generation Apache CXF

I am seeing one behavior while accessing one wsdl. I used Apache Axis 1.3 as well as JAX-WS wsimport tool to generate client stubs, it is successfully generating stubs.
But when I am using apache-cxf-2.7.18 and using wsdl2java command, it's not generating stubs, giving me error.
WSDL is on https. I added proxy in wsdl2java bat file as well. wsdl contains a which is also on https.
Error I am getting like:
enter image description here
It seems to that it's not able to include underlying wsdl.
Can anybody give me any pointer what I am doing wrong?
I believe, when I am doing any service publishing, it can not be client implementation specific like it is supported by Axis but not CXF. or I can do that? Is there any restriction that could be applied?
(Solution in comments)
The error log shows a connection error when downloading the WSDL, probably due to a misconfiguration of the proxy in wsdl2java when using a SSL connection through maven
Maven is not is not able to download imports using the proxy configuration, since you have downloaded the wsdl, you can also download all referenced url resources to local files and change <wsdl:import location= to use each local file. Use a relative path ./yourfile or a URL format file://path/to/the/file

Getting Error while accessing wsimport in Webservice

Getting the below Error while importing an WSDL, I am new to this please guide me what i need to do
[ERROR] com.sun.istack.internal.SAXParseException2;
www.webservicex.net
Failed to read the WSDL document:
http://www.webservicex.net/sunsetriseservice.a smx?WSDL, because 1)
could not find the document; /2) the document could not be read; 3)
the root element of the document is not .
[ERROR] failed.noservice=Could not find wsdl:service in the provided
WSDL(s):
At least one WSDL with at least one service definition needs to be
provided.
Failed to parse the WSDL.
I had a similar issue when using wsimport, specifically specifying the HTTP URL for the WSDL. The solution I found was to download the WSDL and save it locally; wsimport was able to use it fine.
I'm not sure why, but specifying the HTTP URL for the WSDL and running with the -verbose option also solved it.

Problems with web service, Axis2 and Rampart

I'm new with the Web services and I have a problem obtaining the java files from a WSDL.
The devs of the servers gave me this information:
I have to generate the source with a xmlbeans binding using Axis2 and Rampart. The requests must be signed with a trusted certificate (I have one) and add a Timestamp.
That said, I downloaded the lastest versions of Axis2 and Rampart and executed the next command line without getting errors:
wsdl2java -d xmlbeans -uri https://juntadeandalucia.e-factura.net/puef/services/SSPPWebServiceProxyService?wsdl -o .\src\
I don't have a clue about how to configure Rampart (just copied the modules in repository/modules, inside Axis2 directory) and I don't know if it varies the result neither. The case is that, following the Apache web examples, I can't use the java source generated as is.
For example, to use the consultarFactura method I would need to write a source like this, following the Apache web examples:
SSPPWebServiceProxyServiceStub webservice = new
SSPPWebServiceProxyServiceStub(url); ConsultarFacturaDocument doc =
ConsultarFacturaDocument.Factory.newInstance();
doc.setNumeroRegistro(numeroRegistro); return
webservice.consultarFactura(doc); //Return the response
But setNumeroRegistro() its not a method of ConsultarFacturaDocument (witch is an interface), its a method of another interface called ConsultarFactura defined inside the first one.
wsdl2java gave me a wrong or incomplete code?
I have to do something more before generating the code?
Can I use another framework to generate a more clean code? (I tried cxf, but wsdl2java gave me errors, using the xmlbeans binding or not).
Any help would be highly appreciated.
(Sorry for my bad english)

MSDN web service WSDL not parsing

I am trying to create a web services client for Microsoft's MSDN service (MSTP Content Service). When I use my local IDE to generate the classes it is failing to parse the WSDL from Microsoft published at http://services.msdn.microsoft.com/ContentServices/ContentService.asmx?wsdl and so I tried validating it with a "neutral" validator (XMethods WSDL Validator) and the XMethods validator is saying it cannot parse it with no further significant information. I also tried the eXtc validator and got a similar parse failure. How can I get past this error and create a web services client for MSTP?
I needed code stubs in order to communicate with the MS Content Service System. I used Apache CXF which provides tools for generation of Java or Corba stubs. Apache CXF failed because of a misspelled attribute ("messsage" with 3 s instead of 2):
...
<wsoap12:header messsage="this:AppID" part="AppID" user="literal"/>
...
A download of the formal description file (and correction of misspelled attribute name) wasn't successful because there are further files required for stub generation. I download all missing 14 files.
You could download the WSDL description file and execute the Apache CXF stub generation on this file. This script will abort and print the missing file. So, you have to download this file, manually, and to restart the generation which may abort several times because of further missing files. You can find this files in the schemas folder on the web server, e.g.:
http://services.msdn.microsoft.com/ContentServices/schemas/urn_mtpg_com_mtps_2004_1_image_category_atoms.xsd
http://services.msdn.microsoft.com/ContentServices/schemas/urn_msdn_com_public_content_syndication_2006_09_common.xsd
...
Repeatedly download them and put them into a schemas folder near your WSDL description file.