Error retrieving wsdl through URL from service - web-services

In my application I use as a web server Widlfly 17.0.1 and for the wsdl webservices Axis2 1.7.6
I get an error when trying to retrieve the wsdl through URL by a client program from the server URL like http://myserver:8080/myapp/services/MyService?wsdl
When I hit the URL in the browser I get
<error>
<description>Unable to generate WSDL 1.1 for this service</description>
<reason>
If you wish Axis2 to automatically generate the WSDL 1.1, then please set useOriginalwsdl as false in
your services.xml
</reason>
</error>
So far I have tried the suggested solution from here useOriginalwsdl=true is not working in axis2
but without success, the error still remains the same.
Also my wsdl and xsd seem to be valid and the servers service endpoint is also working fine and as expected.
When I use soapUI or my client with provided wsdl, the service seems working fine and is returning the desired response.
But I need to retrieve the wsdl to the client through the servers service URL like http://myserver:8080/myapp/services/MyService?wsdl because for technical restrictions I cannot provide it in the client project.
My services.xml is following:
<service name="MyService">
<messageReceivers>
<messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="org.test.MyServiceMessageReceiverInOut"/>
</messageReceivers>
<parameter name="ServiceClass">org.test.MyServiceSkeleton</parameter>
<parameter name="useOriginalwsdl">true</parameter>
<parameter name="modifyUserWSDLPortAddress">true</parameter>
<operation name="getDocument" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://ws.test.org/myapp/myservice">
<actionMapping>getValue</actionMapping>
<outputActionMapping>http://ws.test.org/myapp/myservice/myservicePortType/output2</outputActionMapping>
</operation>
<operation name="setValue" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://ws.test.org/myapp/myservice">
<actionMapping>setValue</actionMapping>
<outputActionMapping>http://ws.test.org/myapp/myservice/myservicePortType/output1</outputActionMapping>
</operation>
</service>
The service declaration inside the wsdl file is as follows:
<service name="MyService">
<port name="myservicePort" binding="tns:myserviceBinding">
<soap:address location="http://${MyHost}:${MyPort}/myapp/services/MyService"/>
</port>
</service>
Any ideas from anybody?

Related

WSDL xsd import from https to http:443 when deployed

I have a legacy SOAP WS in my JAVA project (1.7) which is currently giving some trouble. In its WEB-INF/wsdl/*.wsdl file there is this block
<xsd:schema>
<xsd:import namespace="https://myUrl.com/" schemaLocation="myService_schema.xsd"/>
</xsd:schema>
right after its deployment, when i download its wsdl via wget I get the following
<xsd:schema xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="https://o2o-staging.beeweeb.com/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="https://myUrl.com/" schemaLocation="http://myUrl.com:443/service-ws/myService?xsd=myService_schema.xsd"/>
</xsd:schema>
as you can see the xsd import address https://myUrl.com becomes http://myUrl.com:443, thus making the service inaccessible as nginx complains with a 400 error: The plain HTTP request was sent to HTTPS port
I really did some searching and found no problem assimilated to this. Can somebody please explain to me what is going on, and how to possibly fix it? the namespace url https: //myUrl.com should really remain that way, and is it possible to avoi its becoming http: //myUrl.com:443 ?
My server is Jboss 7.1
For whom it might be helpful.
When a soap webservice is deployed, jboss re-processes whatever wsdl and xsd you have in your WEB-INF/wsdl. My problem was that in my standalone.xml I had an http connector, while I actually needed an https one.
so you need to
1) change your connector to https (or whatever it is you are yousing for your web-app
<connector name="http" protocol="HTTP/1.1" scheme="https" socket-binding="http"
secure="true" proxy-port="443"/>
2) add and explicit wsdl port in your standalone.xml
<subsystem xmlns="urn:jboss:domain:webservices:1.2">
<modify-wsdl-address>true</modify-wsdl-address>
<wsdl-host>jbossws.undefined.host</wsdl-host>
<wsdl-port>443</wsdl-port>

Mule WSDL Connector

I use version 3.8 (3.8.3) .
I basically want to host my wsdl in a different location other than http://{serviceurl}?wsdl like http://{serviceurl}/my-great-service.wsdl
At the following mule doc
https://docs.mulesoft.com/mule-user-guide/v/3.8/wsdl-connectors
it says that you can specify the _wsdlLocation_ property of the CXF endpoint as follows
<endpoint address="wsdl-cxf:http://localhost:8080/book/services/BookService?method=getBooks">
<properties>
<property name="wsdlLocation" value="file:///c:/BookService.wsdl"/>
</properties>
</endpoint>
But where to put this in the mule xml ?
To the root of the file <mule> here </mule> or to <flow> here </flow> or to the <cxf:proxy-service> here </cxf:proxy-service>
The mule documentation is so limited and lock of examples.
Any reason why you are using the cxf connector instead of the web service consumer?
https://docs.mulesoft.com/mule-user-guide/v/3.8/web-service-consumer
All the global configuration elements are specified after the <mule> tag and before the <flow> elements.
Example with web service consumer below:
<mule ......>
<ws:consumer-config name="Web_Service_Consumer" service="ServiceService"
port="ServicePort" serviceAddress="addresUrl"
wsdlLocation="wsdl location" doc:name="Web Service Consumer"/>
<flow>...</flow>
</mule>
If for any reason you want to use the cxf connector, is the same but using the cxf connector

Mule soap Proxy wsdl fails at relative path resolution of xsd

I have a WSDL and a Mule SOAP proxy web service using the MuleSoft XML Only SOAP Web Service example.
My application is working fine but if i enable validation i have one issue: When the XSD is stored anywhere other than the root of the project, it will not resolve.
I created folders of service and xsd inside /src/main/resources,
however when the service is invoked I receive the following error:
connector.http.mule.default.receiver.02] org.apache.cxf.wstx_msv_validation.ResolvingGrammarReaderController: D:\Developer\Global\BODs\GetListSalesOrder.xsd (The system cannot find the path specified)
java.io.FileNotFoundException: D:\Developer\Global\BODs\GetListSalesOrder.xsd (The system cannot find the path)
This is my mule flow..
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="test" doc:name="HTTP"/>
<cxf:proxy-service port="SyncSalesOrderBinding" namespace="http://www.cg.com/services/oagis/salesOrder" service="SyncSalesOrderService" validationEnabled="true" payload="body" wsdlLocation="services/WebServices/WSDL/SalesOrder.wsdl" doc:name="CXF">
<cxf:schemaLocations>
<cxf:schemaLocation>services/Developer/Global/BODs/GetListSalesOrder.xsd</cxf:schemaLocation>
</cxf:schemaLocations>
</cxf:proxy-service>
<logger message="Success" level="INFO" doc:name="Logger"/>
If your XSD file is imported in your wsdl file the following Code is fine :-
<cxf:proxy-service port="SyncSalesOrderBinding" namespace="http://www.cg.com/services/oagis/salesOrder" service="SyncSalesOrderService" validationEnabled="true" payload="body" wsdlLocation="services/WebServices/WSDL/SalesOrder.wsdl" doc:name="CXF"/>
You don't need to mention your XSD file in CXF component .. it will validate
If you still face any issues then there is patch available here : https://www.mulesoft.org/jira/browse/MULE-5963?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
.... Please you replace your jar with the one attached to the JIRA ... It will work definately

Apache ServiceMix! Request-Replay Web Service message

Hello!
I'm trying to learn some Apache Camel and Apache CXF and of course I've ran into some problems.
What I'm trying to do:
Send timed SOAP messages from ESB to some web service, wait for the reponse from the web service and process it. I'm using Apache ServiceMix!.
What I've done:
Implemented a WSDL file with two operations PingOutput (what I'm sending) and PingInput (what I want to receive from the WS).
Implemented a CXF Endpoint (http://127.0.0.1:8090/ping_ws is a WS mocked with SoapUI):
<cxf:cxfEndpoint address="http://127.0.0.1:8090/ping_ws"
id="Ping_Mocked_WS" wsdlURL="ping.wsdl">
<cxf:properties>
<entry key="dataFormat" value="PAYLOAD" />
</cxf:properties>
</cxf:cxfEndpoint>
Implemented a Camel route:
<camelContext xmlns="http://camel.apache.org/schema/spring" streamCache="true">
<route id="ping-ws">
<from uri="timer://ping_timer?fixedRate=true&period=10000"/>
<bean ref="PingBean" method="createPingRequest" />
<to uri="cxf:bean:Ping_Mocked_WS"/>
<bean ref="PingBean" method="processPingResponse" />
</route>
</camelContext>
What I do not understand:
Why the <bean ref="PingBean" method="processPingResponse" /> gets the correct response from SoapUI (the PingOutput operation defined in WSDL)?
Is this the correct way to achieve my goal? And by this way I mean with one single route?
The codes work correctly, I might have some typos here, please do not mind them.
Thanks!
Ad 1)
Likely because the type defined in the method signature of the processPingResponse method. Camel uses bean parameter binding, and based on the type, it uses its type converter to convert to the given type.
And as the payload is a SOAP response in XML it can use JAXB to convert from XML to the type from the method signature.
To do so it uses camel-jaxb which ServiceMix comes with out of the box.
Ad2)
The route works. What it is you want to do differently?

HTTPS WSDL soap:address location is not correctly rewritten by web-service-proxy

This problem is present in mule 1.3.2-201212121943
WSDL soap:address location is not correctly rewritten by web-service-proxy with .NET WS
<mule ...>
<https:connector name="HTTP_HTTPS" sendBufferSize="0" receiveBufferSize="0" receiveBacklog="0" clientSoTimeout="10000" serverSoTimeout="10000" doc:name="HTTP\HTTPS">
<https:tls-client path="xyz\keystore.jks" storePassword="mulepassword"/>
</https:connector>
<pattern:web-service-proxy name="xyz-ws-proxy" >
<http:inbound-endpoint address="http://localhost:8081"/>
<https:outbound-endpoint followRedirects="true" address="https://xyz/g2g/BPM#[header:inbound:http.request.path]" connector-ref="HTTP_HTTPS" />
</pattern:web-service-proxy>
</mule>
http://localhost:8081/xyz.asmx?wsdl returns wsdl with
<wsdl:port name="XYZEndpointSoap" binding="tns:XYZEndpointSoap">
<soap:address location="http://xyz/g2g/BPM/xyz.asmx" />
</wsdl:port>
<wsdl:port name="XYZEndpointSoap12" binding="tns:XYZEndpointSoap12">
<soap12:address location="http://xyzg2g/BPM/xyz.asmx" />
</wsdl:port>
With another jax-ws service, this configuration works - there was only one soap:address hmm.
This is .NET WS.
Thank you
PS: I have read google results and closed mule issues but nothing works for this service.
I have checked and pattern:web-service-proxy has no problem rewrite all the addresses of a WSDL that contains both a soap:address and a soap12:address.
The issue could actually be due to the way you get the WSDL: with the HTTP inbound endpoint bound to http://localhost:8081 with no path (something I would advocate against: it's better to have a path), the WSDL is available at http://localhost:8081/?wsdl, not http://localhost:8081/xyz.asmx?wsdl.