Does WSO2 change my WSDL file? - web-services

i've just installed the WSo2 service bus to make my own Service Oriented Architecture (SOA).
I'm trying to connect a Ignition (MES/SCADA) system, to a webservice on another (embedded)computer.
I've made the service in the management console, when i use the tryit function, i can fill in the form, but when i send the message i get the following error:
"The endpoint reference (EPR) for the Operation not found is /services/CalculatorWS.CalculatorWSHttpSoap12Endpoint and the WSA Action = null. If this EPR was previously reachable, please contact the server administrator."
When i try to do the same within my Ignition program, i get the following error: unknown url type:"calculatorws"?xsd=http.
I think this has to do with the SOAP message, because i compared the one from my webservice, with the one WSO2 generated.
WSO2 missgenerates the following line within the WSDL:
schemaLocation="CalculatorWS?xsd=http://169.254.166.123:8080/CalculatorApp/CalculatorWSService?xsd=1"
i think this should be:
schemaLocation="http://169.254.166.123:8080/CalculatorApp/CalculatorWSService?xsd=1"
is this the right conclusion? if yes, how can i adjust it?
besides this, when i use the SOAP Messagetracer from WSO2, i do get the answer i want back! how is this possible?
I'd like to hear from you,
Thanks in advance,
T Dantuma

According to your configuration, it looks like you are going to implement WSDL-based proxy. Then you no need to give published WSDL URL. Try to remove above line from proxy as you mentioned:
<xsd:import namespace="http://calculator.me.org/" schemaLocation="CalculatorWS?xsd=http://169.254.166.123:8080/CalculatorApp/Calcu‌​latorWSService?xsd=1"/>
ESB will be adding xsd with relevant namespace
when you define external namespace for given property
you adding external namespace for service within your service and ESB cannot identify your component. Then it will be use given namespace to solve confusions.
Try above methods. If you cannot identify exact error, please add whole configuration in your question (Edit and put the configuration).
If you still get the error:
Please log in to WSDL and check whether it can be accessible
http://169.254.166.123:8080/CalculatorApp/CalculatorWSService?wsdl
Check your invocation method. Becuase "POST" or "GET" request may need special invocations. (Ex: any parameters required for invocation or correct URL may different with exact method)
[1] https://docs.wso2.com/display/ESB490/WSDL+Based+Proxy+Template

Related

Accessing a SOAP service URL from a Clients point of view

I was asked this question in a technical interview for a integration intern role.
He was digging much into understanding of SOAP web services.
Question). Consider that you are exposing a web service through SOAP to a Client.
The url through which you are providing the service is up and running when you check it.
But the Client has a problem, he is not able to access your webservice.
How will you go on troubleshooting this issue?
My response:
I would first check whether the url the client is trying to access the service is correct.
Will check the .wsdl file: port, bindings & will check once whether upon sending a SOAP request to the URL, am I receiving the SOAP response in local through SOAP UI.
If I get error, will troubleshoot based on the kind of error I get: Like page not found, null exception etc.
I felt he was still expecting some other point. He hinted saying where in what registry you will check all the web services which have been hosted(I guess this was much of a production support issue :P)
I told I may look into UDDI registry, but was not sure with this.
Please let me know your inputs on what could be possibly a right approach?
Apache jUDDI PMC here. Yes UDDI could be used to verify that the client is pointed at the right location, assuming the client knows where the UDDI server and that it is registered and the client knows what to query for on the UDDI server and a UDDI query is part of that client's normal workflow. That's a lot of assumptions but certainly feasible.
Most of time, the endpoint is in a config file somewhere or some idiot hard coded it.
That said, this my go to list for checking SOAP service connectivity (from the client's perspective)
DNS resolution of the hostname in the URL
Ping the remote host
HTTP GET to the URL of the SOAP service + ?wsdl (this usually works). This is also a good time to verify SSL connectivity.
You can also parse the WSDL doc, assuming one is returned for identify the endpoint url.
Finally if that all works, execute the service. HTTP 200 is general a positive sign
Edit:
Another alternative approach is to implement a very simple API (wsdl method) on every SOAP service that simple returns a true/false that answers the question "Am I open for business?". This method would provide a standardized approach for identifying if a service was available or not by testing an external dependencies (databases and whatnot).

SOAP Webservice call from Java gives "Object reference not set to an instance of an object"

I have a requirement where I call a SOAP based web service from Java using Axis2 from eclipse. The web service code is in C#, with a BasicHttpBinding.
But when I call the method from the client stub I get this error.
org.apache.axis2.AxisFault: Object reference not set to an instance of an object.
Could anyone help me figure out this one? Is this on the service side or on the client side? Previously I got 'Internal Server error' and then they had to add something so that I can see this error in the logs.
The message is from the C# web service side ("Object reference not set to an instance of an object" is basically a Java equivalent of NullPointerException) but it might be because of something you send from your Java client or maybe you don't send.
The error usually means that you didn't send a required parameter and that the web service didn't do a proper job of validating it's input and missing parameter got to a point when caused the NullReferenceException.
But there is only one way to be sure, and that is to troubleshoot the call.
I suggest you use something like SoapUI to create a message and send that to the service. Once you get a succesfull call in SoapUI, make a call with the same parameters from your Java client and see what happens. When you do that, using a proxy for logging is very useful to see if the sent message is actually the expected one.

WSO2-ESB: SOAP Mediator from wsdl

I have seen some of the SOAP- Example- Mediators. I have not found a transformation based on the endpoint-WSDL.
I want to send some nested named array in json or POX and that data should go into a complete namespaced headered (username, password) SOAP-Request based on the names.
All the examples I have found had either a very simple wsdl or the namespaces were static in the XSL-Transformation.
It should be possible to do that, as I see in for example php-NuSOAP. You feed it with a wsdl-endpoint, the operation you want to execute and the parameter-array, and it calls the Webservice.
I am looking for a solution which is not too much hardcoded for every single service, so the proxy still works when the wsdl changes and Server Clients get changed.
As far as I understand the payload factory mediator in (https://stackoverflow.com/a/12969814/2277620) you would have to hardcode the soap-format in the mediator.
If WSO2 is the wrong tool for that I'd like to have a hint which tool could help.
Thanks in advance!
Marco.
For my understanding, you want to have a proxy, but it's backend service/wsdl may vary..
What , you can do is, you can save the wsdl (dynamic wsdl)in registry and point that in your proxy. whenever you edit the wsdl, proxy will automatically adopt to that..But the request, which you send to your backend should follow the wsdl definitions..It is totally client side responsibility..

Configuring WSDL Based Proxy in WSO2 version 4.6

I have down loaded WSO2 ESB Version 4.6 and started the server. Clicked on proxy service. There I have selected WSDL Proxy option. It is asking the following for creating proxy.
Proxy Service Name* OpportunityService
WSDL URI* https://crm-aufsn4x0ruf.oracleoutsourcing.com//opptyMgmtOpportunities/OpportunityService?WSDL
WSDL Service* https://crm-aufsn4x0ruf.oracleoutsourcing.com:443/opptyMgmtOpportunities/OpportunityService
WSDL Port* 443
I just want consume this external web service via ESB. So I dont want publish. Did not configure any publish related fields. Now When I click on create it throws exception "Failed to add proxy service: OpportunityService. Check whether the Proxy already exists
". But I am sure that there is no existed service with that. I have tried with different names but the error is same.
I suspect that may gave values wrong for fields WSDL Service and WSDL Port. If click on Test URI its giving success.Can any one please suggest where I am doing wrong.
Thanks&Regards,
Raghu
For wsdl service parameter you need to give the <wsdl:service name>which you can find in the particular wsdl itself. I dont think it will be a URI like you have mentioned above. Likewise for port you can find the <wsdl:port> parameter in the wsdl.

Unauthorized HTTP request with Anonymous authentication of SAP PI service

I have a .WSDL file from our client company, for which I need to use to call a web service. Their system is SAP (SAP PI). My application is a C# .NET 3.5 client developed in VS 2008. I added a Service Reference in Visual Studio using their provided .WSDL file. This created a reference class for me to use to call their service, and set up several bindings in the app.config file for me.
I did not change anything in the app.config file, but did create code to call their web service. However, when I call their webservice, I receive the following exception:
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Basic realm="SAP NetWeaver Application Server ..."'.
(I modified slightly the string used in the 'Basic realm' section so as to not give it out.)
Did the app.config not get built correctly from the WSDL? Am I supposed to modify the app.config file somehow?
Things I've tried:
changed authenticationScheme in app.config from Anonymous to Basic
(as well as all the other authentication types)
changed realm string in app.config to match the realm in the exception message
set username/pw fields in the ClientCredentials.Username object in my code
Any pointers or help would be appreciated.
Edit: After some more investigation, I found that Visual Studio has several warnings about the extension element Policy and Policy assertions:
Custom tool warning: The optional WSDL extension element 'Policy'
from namespace 'http://schemas.xmlsoap.org/ws/2004/09/policy' was not
handled.
Custom tool warning: The following Policy Assertions were not Imported:
XPath://wsdl:definitions[#targetNamespace='urn:sap-com:document:sap:rfc:functions']/wsdl:binding[#name='Binding_FieldValidation']
Assertions: ...
I wasnt able to find out if this was related or not to my current issue with the authentication scheme. It does seem to be related, but I havent been able to find any solutions to getting these policy warnings resolved either. It seems WCF doesnt handle the statements in the wsdl very well.
Most SAP services dont support anonymous.
So pass some form of authentication data with the call.
User and password / X.509 Ticket...
If you are sending auth data with the call the try this
Ask the SAP guy to regenerate the WSDL with
No SAP assertions, No policy, SOAP 1.1.
You can also try and edit the WSDL by hand to remove the extra guff...
As a starting point, I'd verify that you can call the service successfully with the provided username and password. Use something like SoapUI to test that everything works correctly - just create a new project, import the WSDL provided by SAP PI, set the username and password and execute the call. You'll probably get some form of exception with an empty payload, but at least that'll verify that the username and password are correct.
Once you've verified that's working, check that your application is calling the service correctly and that the http basic authentication headers are being sent. You can confirm this by using a network monitoring tool and checking that the http request is being generated correctly. Something like netcat for Windows can do it - just make it listen to a port on your local machine and then specify localhost and the port as your SOAP endpoint.
Once you've verified both of those are correct, your call should succeed.
There must be the Basic authentication header missing or something wrong
with the credentials.
SAP PI always defaults to Basic Authentication if a Service is published via it's SOAP Adapter. I would investigate if WCF really does send out that header (e.g. Point your client endpoint to TCP Gateway and let TCP Gateway point to the SAP PI Endpoint from the WSDL).
About the Warnings: AFAIK the WSDL generated by SAP PI will always contain these Policy Tags, you can't really ommit it. What you can do is simply throw them out as they are not really validated