Getting Error while accessing wsimport in Webservice - web-services

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.

Related

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

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.

Generating WSDL Proxy for external web service

I am trying to configure wsdl proxy in WSO2 ESB. It is not allowing the following WSDL URL.
https://secure-ausomxapa.crmondemand.com/OnDemand/user/Opportunity.wsdl?WSDLOBJ=Opportunity&WSDLTYPE=CUSTOM&XSDOnly=N&ECBS=Y
I am checking " Publish Same Service Contract" check box while creating. But its throwing ERROR - RPCMessageReceiver com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected chara
cter '=' (code 61); expected a semi-colon after the reference for entity 'WSDLTYPE'
But the above url is correct and it opens correctly by giving user name and password.
I have encoded the above WSDL URL, but its not allowing me to even. Please suggest me what should be the problem with this URL.
Thanks&Regards,
Raghu
Download the particular wsdl to your local file system and provide the wsdl path for the "wsdl uri" option like;
file:E:/releases/wso2esb-4.0.3/repository/samples/resources/proxy/sample_proxy_1.wsdl

wsimport - Two declarations cause a collision in the ObjectFactory class

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.

WSDL/SOAP Test With soapui

I have tested my web services (wsdl/soap) with soapui. and i have the errors :
http/log : error 400 BAD REQUEST.
What can be the error please with my wsdl ?
error/log :
un Jun 05 14:10:37 CEST 2011:ERROR:javax.wsdl.WSDLException: WSDLException (at /html): faultCode=INVALID_WSDL: Expected element '{http://schemas.xmlsoap.org/wsdl/}definitions'.
javax.wsdl.WSDLException: WSDLException (at /html): faultCode=INVALID_WSDL: Expected element '{http://schemas.xmlsoap.org/wsdl/}definitions'.
at com.ibm.wsdl.xml.WSDLReaderImpl.checkElementName(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlInterfaceDefinition.load(WsdlInterfaceDefinition.java:48)
at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlContext.loadDefinition(WsdlContext.java:66)
at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlContext.loadDefinition(WsdlContext.java:30)
at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext.cacheDefinition(AbstractDefinitionContext.java:264)
at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext.access$400(AbstractDefinitionContext.java:44)
at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext$Loader.construct(AbstractDefinitionContext.java:230)
at com.eviware.soapui.support.swing.SwingWorkerDelegator.construct(SwingWorkerDelegator.java:46)
at com.eviware.soapui.support.swing.SwingWorker$2.run(SwingWorker.java:140)
at java.lang.Thread.run(Thread.java:637)
definitions is a root element of WSDL so it looks like you are not loading WSDL.
Edit:
I tested it and it looks like the whole problem is with your web server. Your web server returns WSDL to browser but it doesn't return it to any tool because these tools are using very minimalistic HTTP requests without many HTTP headers. One of missing headers is Accept. Once this header is not included in the request your server throws HTTP 400 Bad request.
The easy approach to continue is opening WSDL in the browser, save the wsdl to a file and import that file to soapUI instead of the WSDL from URL.
Another possibility is that you need to add ?wsdl at the end of your service url for SoapUI.
That one got me as I'm used to WCFClient which didn't need it.
You can try opening the wsdl in web browser and saving with .wsdl extension. And set the WSDL in SOAP UI project to this .wsdl file.
This really works.
yes, first ensure you added "?wsdl" to your "http......whatever.svc" link.
That didn't fix my problem, though. I had to create a new WCF project from the beginning and manually copy the code. That fixed it. Good luck.
And most important!!!
When you change a namespace in your code, also make sure you change it in web.config!
I faced the same exception while trying to test my web-services deployed to WSO2 ESB.
WSO2 generated both wsdl and wsdl2. I tried to pass a wsdl2 URL and got the above exception. Quick googling showed me, that one of differences between wsdl1.1 and wsdl2.0 is replacing 'definitions' element with 'description'. Also, I found out, that SoapUI does not support wsdl2.
Therefore, for me the solution was to use wsdl1 url instead of wsdl2.
A likely possibility is that your browser reaches your web service through a proxy, and SoapUI is not configured to use that proxy. For example, I work in a corporate environment and while my IE and FireFox can access external websites, my SoapUI can only access internal web services.
The easy solution is to just open the WSDL in a browser, save it to a .xml file, and base your SoapUI project on that. This won't work if your WSDL relies on external XSDs that it can't get to, however.
For anyone hitting this issue in the future: the specific situation here ("the server isn't sending back the WSDL properly") may or may not always be relevant, but two key aspects should always be:
The message faultCode=INVALID_WSDL: Expected element '{http://schemas.xmlsoap.org/wsdl/}definitions' means that the actual content returned is not XML with a base element of "definitions" in the WSDL namespace.
The message WSDLException (at /html) tells you an important clue about what it did find — for this example, /html strongly implies that a normal webpage was returned, rather than a WSDL. Another common situation is seeing something like /soapenv:Reason, which would indicate that the server was trying to treat it as a SOAP call — for example, this can happen if your URL is for the "base" service URL rather than the WSDL.
I had the same problem, and the solution (for me) was to:
open SoapUI Preferences
click on SSL Settings
clear out the KeyStore and KeyStore Password text boxes
untick the bottom checkbox for Client Authentication, requires client authentication.
On AspNet services with .svc endding you must terminate URL as "?wsdl".
Otherwise, SoapUI will try to read the land page HTML of the Service (that is not a WSDL, right?)
Eg.:
http://localhost:1234/WebServices/WsBlahBlahBlah.svc?wsdl