× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Scott ,
thanks for you reply ..
sorry for my confusion, in effect INVSTAT is for XML and not Json. Anyway
I have the same problem also with other Web service the wait for Json file.
My purpose is to understand why the my friend's code "send" in the REQMETH
fields the 'OPTIONS' values , as my friend should write an App that should
call the Ibm I Web service, but if he (my friend) don't understand how to
call Ibm I' s Web service we can't go on in our project .. so i would ask
to Html with jQuery (??) expert if can help us to understand where we are
wrong ..

Thanks



-----Messaggio originale-----
Da: WEB400 [mailto:web400-bounces@xxxxxxxxxxxx] Per conto di Scott Klement
Inviato: martedì 4 agosto 2015 18:08
A: Web Enabling the IBM i (AS/400 and iSeries)
Oggetto: Re: [WEB400] Example for calling Web Service and Post a Json File

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=ShowAllIssue
Code> 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>







--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list To post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.