I have a WSO2 ESB (4.8.1) proxy PA which calls another ESB proxy PB (which has a published WSDL). When I call the SomeOperation operation in the PB proxy from SoapUI, it just works: I get the expected response and it validates against the WSDL schema.
I need to call PB from PA, so I build the corresponding message body with payload factory, set Action header with the SomeOperation value (as the action is defined in the WSDL), and use call mediator with the corresponding endpoint. What I get is a fault body, with the following error message:
The endpoint reference (EPR) for the Operation not found is /services/SomeOperation and the WSA Action = urn:mediate. If this EPR was previously reachable, please contact the server administrator.
However, it happens that if I simply edit the endpoint defined in PA, so that I concat /SomeOperation at the end of the service url, then it works.
Is it possible to address this issue without this workaround? Why could this be happening? I now some posts with similar errors suggest setting the Action header, but I am actually setting it.
EDIT: It seems solved, based on the first answer by Jean-Michel.
Further details: I observe there is only SOAP12 binding in the PB wsdl... Anyway, PB performs an operation switch based on the Action property.
Case: PB (unmodified), PA with soap11 format EP
It works!
Case: PB (unmodified), PA with soap12 format EP
The endpoint reference (EPR) for the Operation not found is /services/PBService and the WSA Action = null.
Case: PB (disableOperationValidation), PA with soap11 format EP
It works!
Case: PB (disableOperationValidation), PA with soap12 format EP
org.apache.axis2.AxisFault: The input stream for an incoming message is null.
I don't completely get what is going on, but I guess I'll try to stick to soap 1.1.
Try to set this parameter inside your proxy def (PB) :
<parameter name="disableOperationValidation" locked="false">true</parameter>
Edit your endpoint and set the appropriate format (soap11 or soap12)
Related
I have published API in WSO2 using swagger JSON. After publish I am trying to call rest api using swagger in APP Console. It says
Response Body no content
Response Code 0
Response Headers {
"error": "no response from server"
}
There is no any error on server which will help me to understand problem.
Here is the request URL which I am using in local server : https://192.168.1.118:8243/api/2.0/questions/1/answers?start=1&end=1&fields=answerId%2CanswerDescription%2CcreateDate
In my API there are some custom header parameter. Because of this custom header parameter it was not working. I have added custom header parameter in api-manager.xml file.
<Access-Control-Allow-Headers>authorization,Access-Control-Allow-Origin,Content-Type,loggedInUserId,accessToken,clientToken</Access-Control-Allow-Headers>
I have faced a similar issue. I have edited the URL(from apicreator login) after it was published for first time and published it again. But the changes were never reflected. WSO2 was pointing to the old URL. Check the logs for error at "WSO2 HOME\repository\logs\wso2-apigw-errors" . Create another version and publish again and it should work.
The error is real, but misleading. In most likelihood, you've set the spec so that it returns a specific content type (say, application/json) but you actually return plain text (like a string or a number). swagger-ui expects it to be a JSON, tries to parse it and fails, giving you the wrong error message. However, it does mean your spec does not match what your API actually does.
I am trying to implement a partner link with a dynamically determined endpoint address in a WSO2 BPS BPEL process. The idea is that the request sent to the process contains an endpoint URL and that this URL is used as the address for a certain partner link. I have successfully used endpoint references stored in the registry before, but I can't use that approach here as the address can be different every time the process is called.
I have tried a number of different approaches (using WSO2 BPS 3.5.1 and WS02 Developer Studio 3.8.0):
The approach used in the DynPartner example referenced in https://stackoverflow.com/questions/11092515/dynamic-partner-links-and-dynamic-addressing-with-ode-bpel. This gives me the following validation error in Developer Studio: The from-spec of "<xs:simpleType "string">" is not compatible with to-spec of "<wsdl:portType
"DynResponderPortType">". Also, when I deploy and invoke the process, I get an error stating that the endpoint cannot be created (Couldnt create any endpoint for element ...)
Assigning a fixed value to the partner link, e.g. like this:
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wsdl11="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com uep_schema.xsd">
<wsa:Address>http://localhost:8281/services/serviceaddress</wsa:Address>
</wsa:EndpointReference>
This works and does not give a validation error, but I haven't found a way to dynamically change the address that is used here based on the input my process is called with.
Create a variable that holds the endpoint reference, using a type that defines the content of an endpoint reference. I've tried several XSDs (http://docs.oasis-open.org/wsbpel/2.0/OS/serviceref/ws-bpel_serviceref.xsd, http://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/components/unified-endpoint/org.wso2.carbon.unifiedendpoint.core/4.2.0/src/main/resources/schema/uep_schema.xsd (which doesn't get validated without errors), the ws-addr.xsd from w3c, my own very simple XSD). I've had varying success with regarding how well Developer Studio could handle them and for instance generate initializations, but they all share the problem that I get a validation error stating something like The from-spec of "<element "EndpointReference">" is not compatible with to-spec of "<wsdl:portType
"ThisIsThePartnerLinkPortType">" -.
At this point, I am using the last approach with my own simple XSD. The process is actually working the way I intend it to, but I am still getting validation errors in Developer Studio which I would like to get rid of. Is there another and better way to approach this?
Thanks in advance for your help.
For anyone who is having the same issue: The approach is use now is that the BPS calls a specific proxy in the ESB (at a fixed location) and provides the endpoint URL to that proxy. The proxy then performs the actual call to the endpoint.
This has a number of advantages for me:
I get rid of the validation errors in the BPEL designer
Passing through the ESB allows me to perform validation on the message that I receive from the service located at the dynamic URL. Note that this is not possible in the BPS at the moment, as validation is not yet properly implemented. See also https://docs.wso2.com/display/BPS351/WS-BPEL+2.0+Specification+Compliance
I am getting the Blank JSON body in request. due to that ESB is given the below error.
org.apache.axis2.AxisFault: No JSON payload provided.
I am using the wso2 esb 4.9.0 version.
request is POST.
Can you please help in that .
This is a limitation of ESB, you can either send an empty json payload as {} or you can set the Content-Type as application/xml in the request.
According to the HTTP spec "The Content-Type entity-header field indicates the media type of the entity-body sent to the recipient or, in the case of the HEAD method, the media type that would have been sent had the request been a GET"
[1] https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
So if you are defining the media type as "application/json", then there should be a matching entity body for POST. That is why you need to send at-least empty JSON body. If you don't have a body then change the resource to GET rather POST.
But the I found the issue. yes you are right but in Wso2 ESB 4.8.1 if we pass any message with without body as post then we got the error to avoid that we had created the blank payload to call that API. as soon as I removed that blank payload issue resolved. I agreed that post need that body but I had to consume the message of other system that will provide the same (Post with body).
one more thing. if any one put log as full then also you will get the same error.
I am badly stuck with a SOAP based integration using Axis2 framework for generation of client stubs from the Server WSDL. The scenario is as follows :
There is always a login API call first, which gives a Success response in SOAP body and Temporary Redirect in HTTP header. Also provides a URL which contains the session ID in the Location field of HTTP Header.
The next API call is required to be made at this redirect location. IN THE SAME TCP CONNECTION, for getting a proper response.
Now, the problem is, as a part of Webservice implementation using Axis2 generated stubs, I need to reload this redirect URL and re-instantiate it as --- "stub=new Stub(newurl)"
As soon as this is done, it creates a new TCP connection and so, the next request gives the response as "session ID invalid" because it goes out-of-sync with login API.
I have tried everything mentioned as a solution in this forum and nothing is working out.
For e.g --
MultiThreadedHttpConnectionManager httpConnectionManager = new MultiThreadedHttpConnectionManager();
HttpClient httpClient = new HttpClient(httpConnectionManager);
ServiceClient serviceClient = stub._getServiceClient();
Options opts = stub._getServiceClient().getOptions();
opts.setTo(new EndpointReference(prop.getProperty("target_end_point_url")));
opts.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Constants.VALUE_TRUE);
opts.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
serviceClient.setOptions(opts);
stub._setServiceClient(serviceClient);
Similarly, I have tried many other options too. But it's not helpful at all.
Faced exactly the same issue.
Following steps solved the issue.
1. Using HttpClient, perform login. Don't use stub object to perform login.
2. Use the Location Header URL, to create new stub object i.e. stub = new Stub(locationURL). (Your existing options setting should be retained.)
3. There is a default timeout, by which server disconnects the TCP connection. In my case it was 50 seconds. Hence as soon as i performed login in step 1, i execute a timer every 40 seconds, to send an empty requests to new Location URL using HeadMethod of same HttpClient object.
I want Play to call a webservice. The webservice accepts application/json and returns this as well. With the following code I'm trying to achieve this. (Note, the headers.put(xxx) are added later in an effort to solve the problem).
WSRequest request = WS.url(targetURL);
request.body = new Gson().toJson(user);
request.headers.put("Content-type","application/json");
request.headers.put("Accept","application/json");
request.post();
The strange thing is that my JBOSS server replies: "Cannot consume content type". If I use my 'Simple REST client' plugin in my Chrome browser, and provide the entire JSON Body GSon created and add the content-type header, I get a valid response. Is this not the way to send JSON to the server? Or am I missing some fundamental piece here?
While checking the API documentation on the WSRequest class i noticed the field mime-type
By setting it as follows JBOSS (resteasy) accepted my request succesfully.
request.mimeType = "application/json";