Gio.Cot,

I'm not understanding this at all. You say you want to send JSON data, but your example is not JSON at all, it's XML.

You say that REQMETH is set to 'OPTIONS' rather than POST, which means that your method of calling this web service is not working properly. You provided some code (looks like HTML with jQuery) but I'm not familiar enough with jQuery to tell you what's wrong with it.

Instead, please consider using SoapUI to test your web services. Recent versions of SoapUI have the ability to call REST web services (as well as SOAP) and it works very nicely.

If you are using YAJL, there's now a routine called yajl_stdin_load_tree() that can load the JSON data directly from stdin, so you don't have to code that part yourself (very similar to the yajl_writeStdout routine we discussed in a previous thread.)

Good luck!


On 8/4/2015 9:57 AM, gio.cot wrote:
Hi all



My friends written a small code's piece (see below) to call an ibm I's web
service and post a Json file; But when I run it for calling for example
Scott Klement INVSTAT (downloaded from
<http://www2.systeminetwork.com/code/index.cfm?fuseaction=ShowAllIssueCode>
http://www2.systeminetwork.com/code/...owAllIssueCode (July 2012 Source
Code)), in debug mode I see REQMETH fields with 'OPTIONS' value and the
inputXml empty. I Know that I for testing I could call my ibm I's web
service also with an RPG program , but we need to know how to call ibm I's
web service also from other server/device out of Ibm I world . Can some help
us to understand where the below code is not Ok.



Thanks in advance





<!DOCTYPE html>

<html>

<head>

<title>AJAX POST Form</title>

<meta charset="utf-8">

</head>

<body style="padding:10px; background-color:#ddd">



<div id="response">

<pre></pre>

</div>



<form id="my-form">

<input id="adress" name="adress"
value="http://192.168.1.10:12345/json.php"; style="width:100%;
margin-bottom:10px;" placeholder="Adress" /><br>

<textarea id="content" name="content" style="width:100%; height:200px;"
placeholder="Content file JSON"></textarea>

<br><br>



<button type="submit" style="width:150px; height:40px;">Send</button>

</form>



<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js";></scr
ipt>

<script>

(function($){

function processForm( e ){

$('#response pre').html('');

$.ajax({

url: document.getElementById('adress').value,

dataType: 'text',

type: 'post',

contentType: 'application/json',

data: document.getElementById('content').value,

success: function( data, textStatus, jQxhr ){


var now = new Date();

$('#response pre').html( now + " Sent data " );

},

error: function( jqXhr, textStatus, errorThrown ){

$('#response pre').html( "ERROR: " + errorThrown );

}

});



e.preventDefault();

}



$('#my-form').submit( processForm );

})(jQuery);

</script>

</body>

</html>








As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.