���N�G�X�g |
GET /WebSite1/WebService.asmx/getHello?str=string HTTP/1.1 Host: localhost |
���X�|���X |
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <string xmlns="http://tempuri.org/">string</string> |
���N�G�X�g |
POST /WebSite1/WebService.asmx HTTP/1.1 Host: localhost Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://tempuri.org/getHello" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <getHello xmlns="http://tempuri.org/"> <str>string</str> </getHello> </soap:Body> </soap:Envelope> |
���X�|���X |
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <getHelloResponse xmlns="http://tempuri.org/"> <getHelloResult>string</getHelloResult> </getHelloResponse> </soap:Body> </soap:Envelope> |
<?xml version="1.0" encoding="utf-8"?> <s:schema xmlns:s="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://tempuri.org/"> <s:element name="getHello"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="str" type="s:string" /> </s:sequence> </s:complexType> </s:element> <s:element name="getHelloResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="getHelloResult" type="s:string" /> </s:sequence> </s:complexType> </s:element> <s:element name="string" nillable="true" type="s:string" /> </s:schema> |
���̂��߁A�p�����[�^�̐��������Ȃ��Ă���ƁAURL�����ɒ����Ȃ�댯������B�uRFC2616 Hypertext Transfer Protocol -- HTTP/1.1�v�ɂ��AHTTP�̎d�l���URL�ɒ��������͂Ȃ����A�l�b�g���[�N���ɂ���Ă͖�肪�N����\��������̂ŁA�����Ȃ�߂��Ȃ��悤�ɒ��ӂ��Ȃ���Ȃ�Ȃ��B
��D http://hostname/hoge.cgi?id=1234 http://hostname/hoge.cgi/id/1234/ ���s�A�X�y�[�X�A���{��Ȃǂ̓G���R�[�h
���{��������ꍇ�́A�����R�[�h�̈�����A���ꕶ���̕��������ɒ��ӂ��Ȃ���Ȃ�Ȃ��B�u��т���UTF-8�Œʂ��v�Ƃ���̂��m���ł���B
�T�[�o�� ���� Java�Frequest.getParameter("param1")
PHP�F$_GET['param1']
���̑��FQUERY_STRING�Ȃ��o�� HTML�ł͂Ȃ�XML��Ԃ� �N���C�A���g�� ���N�G�X�g HTTP��TCP�𑀍삷�郁�\�b�h�𗘗p
JavaScript�FXMLHttpRequest�AActiveXObject ("Microsoft.XMLHTTP")
Java�FHttpURLConnection���X�|���X XML���Ԃ��Ă���̂ŁADOM API�ő���
�EREST�A�N�Z�X�̃T���v���iJavaScript�jURL�̍Ō�ɁA���݂̃~���b��lj����Ă���̂́A�r���̌o�H�ŃL���b�V�����Q�Ƃ����̂�h�����߂ł���B
function requestRest(){ var endpoint = "http://�z�X�g��/WebSite1/WebService.asmx"; // ���M�� var param1 = "keywork"; // �p�����[�^ // URL�� var url = endpoint + "/getHello?str=" + encodeURI(param1) + "&dummy="+(new Date().getTime()); // XMLHttpRequest���쐬 try { xmlhttp = new XMLHttpRequest(); // Netscape, Firefox�Ȃ� } catch (e){ try { xmlhttp = new ActiveXObject ("Msxml2.XMLHTTP"); // IE } catch (e){ try { xmlhttp = new ActiveXObject ("Microsoft.XMLHTTP"); // IE } catch (e){ // XMLHttpRequest�̍쐬�Ɏ��s } } } xmlhttp.onreadystatechange = method1; // ���X�|���X����������ɌĂ�郁�\�b�h���w�� xmlhttp.open('GET', url, true); xmlhttp.setRequestHeader ("Content-Type","text/xml; charset=utf-8"); xmlhttp.send(); // REST�ő��M } function method1() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { alert(xmlhttp.responseText); // ���ʂ��f�o�b�O�\�� } }
�ESOAP�A�N�Z�X�̃T���v���iJavaScript�j�������A����ł̓p�����[�^�̌^�̓`�F�b�N����Ȃ����A "<"�̂悤�ȕ����������Ă��Ă����̂܂ܑ��M���Ă��܂��BDOM��API���g���Ă��Ȃ����߂ɁA���M�O�Ɂu�X�L�[�}�ɍ��v���Ă��邩�H�v��uXML�Ƃ��Đ��������H�v���`�F�b�N���邱�Ƃ��ł��Ȃ��B�~�h���E�G�A�Ŏ����������ꂽ�R�[�h���g���Ă���A�R���p�C�����ɖ������o�ł�����A�C�����C���w���v�Ƃ������J���c�[���̎x���@�\��L���Ɏg�����Ƃ��ł���B
function requestSoap(){ var endpoint = "http://�z�X�g��/WebSite1/WebService.asmx"; // ���M�� var param1 = "keywork"; // �p�����[�^ // SOAP���b�Z�[�W���쐬 var msg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\ <soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n\ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \n\ xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n\ <soap:Body>\n\ <getHello xmlns=\"http://tempuri.org/\">\n\ <str>" + param1 + "</str>\n\ </getHello>\n\ </soap:Body>\n\ </soap:Envelope>"; // XMLHttpRequest���쐬 try { xmlhttp = new XMLHttpRequest(); // Netscape, Firefox�Ȃ� } catch (e){ try { xmlhttp = new ActiveXObject ("Msxml2.XMLHTTP"); // IE } catch (e){ try { xmlhttp = new ActiveXObject ("Microsoft.XMLHTTP"); // IE } catch (e){ // XMLHttpRequest�̍쐬�Ɏ��s } } } xmlhttp.onreadystatechange = method2; // ���X�|���X����������ɌĂ�郁�\�b�h���w�� xmlhttp.open('POST', endpoint, true); xmlhttp.setRequestHeader ("Content-Type","text/xml; charset=utf-8"); xmlhttp.setRequestHeader ("SOAPAction","\"http://tempuri.org/getHello\""); xmlhttp.send(msg); // SOAP���b�Z�[�W�𑗐M } function method2() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { xmlDoc = xmlhttp.responseXML; // ���ʂ�DOM�I�u�W�F�N�g�Ƃ��Ď擾 } }
�E�e�����̔�r
SOAP REST JSON �w�K�e�Ր� �~ �� �� �R�[�f�B���O���i�����������͏����j �� �~ �� �e�X�g�̂��Ղ� �~ �� �~ �J���c�[�� �� �~ �~ �����̗e�Ր� �~ �� �� �J���ɂ�����g�[�^������ �~ �� �� ���G�ȃf�[�^�̓��� �� �~ �~ ���G�ȃf�[�^�̏o�� �� �� �� �����Ȍ^�`�F�b�N �� �~ �~ �ėp���i������J������̎�ށj �� �� �~ �W�����c�� W3C - ecma �g�����iWS-*�j �� �~ �~
Copyright (c) XML �R���\�[�V�A�� 2007 All rights reserved. Copyright (c) �A�h�\�����i������� 2007 All rights reserved.