We need to update order status to php based system using jd edwards web services. we need to make a call to below API from JDE web service.
sample code to call API from PHP is below...Similar logic we will need to use into JDE business service...
FIELD DESCRIPTION SAMPLE VALUES
key Identification token 12334566
order Order identification number 3008
json (Optional) 0 to get XML response,
1 to get JSON response 0
Parameters can be provided using GET properties, POST properties, XML or JSON.
<?php
$r = new HttpRequest('http://[enter server name/ip]/client_api/update_order/', HttpRequest::METH_POST);
$r->addPostFields(array(
'key' => '12334566',
'order' => '3008',
'json' => 0
));
try {
echo $r->send()->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
This call will send status code response if correct/failure.
Any suggestion for possible ways to do this and any samples???
Well it's quite easy, just write your C function that call a custom JDE web service and wrap a java http get (using the standard java api) to call your backend. I don'y have an full example but you can follow the Oracle guide for BSSV consumer and search over the internet for the java http get.
Related
I am integrating FitBit with my company's platform and we are switching over from syncing with our own server to sending the data to an AWS Kinesis stream. This requires us to also set up an AWS API Gateway with a POST method to write the data to the stream. I've also set up a GET method on the same resource for the verification process.
Here's the problem I'm facing:
Once I have the API Endpoint properly set up, FitBit provides a verification code and requires a verification process in which it sends a GET request to the endpoint with a ?verify={correctVerificaitonCode} query param and wants a 204 response, and one with a ?verify={incorrectVericationCode} param and wants a 404 response. This would obviously be easy for me to accomplish in our Rails backend, where I'm in control of the code, but on AWS it's a tangled mess with little control.
I have read endless documentation on AWS about Mapping Templates and Integration Response, but no matter what I do, I cannot get the API to respond with anything other than a 200 (when the request is clean and has any ?verify param) or 500 (when I purposefully make a bad request). There is no straightforward answer in the AWS docs about this.
This is the closest I have come to a setup that the docs promise should work, yet it does not:
Using the Integration Response HTTP Status Regex
And with this mapping template
I'm two days in on this and frustrated to my wits' end. Help!
Just in case anyone find this thread in the future and is struggling with the same issue - here is how you verify a FitBit Developer API app with an Amazon Kinesis stream being fed by an AWS API Gateway:
First, set up the POST method of your API - there are AWS guides to this. Select AWS service as the integration type and kinesis as the service, then set up a mapping template for 'application/json' to look like this:
#set($event = $input.body)
#set($data = '{"action":' + $event +', "authorization": "' + $input.params('Authorization') + '", "stage":"' + $context.stage + '"}')
#set($body = $util.base64Encode($data))
{
"Data": "$body",
"PartitionKey": "shard-1",
"StreamName": "gm-fitbit"
}
Once you've done that, create a GET method on the same resource. Set MOCK as the integration type and create the endpoint. Now click on the GET method and visit Method Request. Expand URL Query String Parameters and add verify as a query param. Now, go back to the method and visit Integration Response.
Under the already existing 200 response method, expand it and add an HTTP status regex of 2\d{2} and passthrough handling.
Expand Mapping Templates, and for 'application/json' create this mapping template:
{
#if( $input.params('verify') == "theVerificationCodeProvidedToYouByFitbit" )
#set($context.responseOverride.status = 204)
#else
#set($context.responseOverride.status = 404)
#end
}
That's it! Deploy the API again, head back to Fitbit, and click verify!
There. Now there is officially a guide online to integrating Fitbit with an AWS Kinesis stream, the one I wish I had when struggling with this for 3 days.
Cheers!
I am using Django, Neo4j, and pentaho. In Pentaho Data Integration, we can use the javascript for any transaction. My question is that can we call ajax from the PDI javasticpt to django server method. Actually i want to send success msg to server after the ETL process done by the PDI. Following is the javascript I am trying.
var xhReq = new XMLHttpRequest();
xhReq.open("GET", "http://127.0.0.1/url_name/?parameter=value", false);
xhReq.send();
Don't re-invent the wheel my friend!, use the "REST Client" step as the last step of your flow, and use the parameters in the step to specify the GET Method and URL with GET parameters to send. After executing the "REST Client" you will get the expected response as you specified in the parameters (maybe a JSON if your server answers it).
You don't need to code with javascript (actually is possible with User Defined Java Class with coding, but it's a more complex process).
I have a SOAP webservice and details of the service provided are: webservice name: "xyz", username: "Ashish", class name: "Initializer" and method name: "Fetchvalue". I have to call the method "Fetchvalue" in which an object of class "Initializer" is used as a paramter. I am developing a web app using SAP UI5, i tried a lot to call this method but not able to get a proper solution for this. Will you please tell me how can i call this method with specific requiremenst resulting in desired output from the webservice.
It would be possible to call a SOAP method from a UI5 application, but there are no specific UI5 components to help you with that. This means that you'll just have to make do with the lower level function, either provided by jQuery or by calling XMLHttpRequest directly.
jQuery has a specific soap plugin for this purpose, that makes calling SOAP methods quite easy:
$.soap({
url: 'http://my.server.com/soapservices/',
method: 'helloWorld',
data: {
name: 'Ashish Jain',
msg: 'Hi!'
},
success: function (soapResponse) {
// do stuff with soapResponse
},
error: function (SOAPResponse) {
// show error
}
});
Please note that the eventual call is made using XMLHttpRequest, which requires CORS headers to be setup on the server hosting your SOAP service. Alternatively, you could setup a proxy on the server that is hosting your UI5 app, that links to the server hosting the SOAP service. If you go this path, you may also want to see if you could have this proxy layer to translate SOAP into JSON for you. That would allow you to easily use a JSONModel from your UI5 app, which makes things easier and cleaner at the UI side.
Since you mentioned that you'll have to call the SOAP service using a username and password, I think a word of caution is mandatory in this answer. UI5 apps run in the browser of your end-user. This means that your end-user can have a look at your Javascript code. Hence, having a username and password in your Javascript code is bad practice. You may want to see if you can push authentication to the SOAP end-point to the proxy if possible.
I am trying to consume the following web service from ColdFusion:
http://xserv.dell.com/services/assetservice.asmx
I should be able to consume the web service using the code below:
<cfscript>
params = structNew();
params.guid = "11111111-1111-1111-1111-111111111111";
params.applicationName = "test";
params.serviceTags = "JLJMHX1";
ws = createObject("webservice", "http://xserv.dell.com/services/assetservice.asmx?wsdl");
writeDump(ws)
ws.GetAssetInformation(params);
</cfscript>
The results of dumping out the WSDL information (ws), indicates that the GetAssetInformation method has the following signature:
getAssetInformation(com.microsoft.wsdl.types.Guid, java.lang.String, java.lang.String)
The service call errors every single time, saying that:
"Error Occurred While Processing Request
Web service operation GetAssetInformation with parameters {11111111-1111-1111-1111-111111111111,test,JLJMHX1} cannot be found."
I am sure this is due to the method expecting a "com.microsoft.wsdl.types.Guid" data type, but how can I pass that in via ColdFusion?
I can create and run the request in Fiddler with the same data and get a response back without issue, so there is something I am doing wrong in ColdFusion.
Any help would be appreciated.
The method expects a guid and two strings. You are passing a structure. Pass the arguments separately.
ColdFusion 10 also introduces Axis 2 for web services by default. For some web services, you need to use Axis 1 which you can enable in the ColdFusion Administrator. You will also need to refresh the web service.
createObject("webservice", theURL, {refreshWSDL=true,wsVersion=1})
I found the answer by following the instructions in this post:
Consume SOAP web service having complex types
Thanks for the help everyone!
I am trying to find how to issue a call to the following restful service from JMeter:
#DELETE
#Path("/user")
void removeUser(String userId);
There are plenty examples on POST, GET, but I cannot find one for delete. Specifically, I cannot find a way to pass a parameter for "userId".
Thanks
You could use #RequestParam or #PathVariable to bind the userId . You don't find many tutorial on Delete since it is not supported in earlier versions of HTML . Read this blog for more info . This is usually achieved through a hidden parameter .
Read this post Are the PUT, DELETE, HEAD, etc methods available in most web browsers? for more info .
Have you tried to record that request using jMeter Proxy?
Simply:
Add > Logic Controller > Recording Controller to your Test Plan
Add > Non-test elements > Http Proxy Server to your WorkBench
As Target controller choose your Recording controller
Set your browser proxy settings to point to your jMeter machine (usually your localhost) on standard port 8080
Click Start button at the bottom of your Http Proxy Server component
Fire that delete request in your browser
Immediately after submitting the request, stop the Http Proxy Server (to avoid recording other junk, usually ajax/refresh requests from other opened tabs)
See what jMeter recorded
Use the recorded sampler(s) to build your real test
Details here.
Aha, OK, than maybe you can link (bypass a web app) jMeter with Spring by using jMeter's jUnit Sampler to fire your jUnit test cases directly.
More here: http://jmeter.apache.org/usermanual/junitsampler_tutorial.pdf
Also, take a look here how a guy tried to write a custom jMeter Sampler that was supposed to mimic Spring's HttpInvoker (HttpInvokerProxyFactoryBean).