среда, 18 сентября 2013 г.

Example of wsdl to use with anonymouse webservice call in BMC Remedy

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:s0="urn:ISS_WS_Test1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:ISS_WS_Test1">
   <wsdl:types>
      <xsd:schema elementFormDefault="qualified" targetNamespace="urn:ISS_WS_Test1">
         <xsd:element name="New_Create_Operation_0" type="s0:InputMapping1" />
         <xsd:complexType name="InputMapping1">
            <xsd:sequence>
               <xsd:element minOccurs="0" name="userName" type="xsd:string" />
            </xsd:sequence>
         </xsd:complexType>
         <xsd:element name="New_Create_Operation_0Response" type="s0:OutputMapping1" />
         <xsd:complexType name="OutputMapping1">
            <xsd:sequence>
               <xsd:element name="Request_ID" type="xsd:string" />
            </xsd:sequence>
         </xsd:complexType>
         <xsd:element name="AuthenticationInfo" type="s0:AuthenticationInfo" />
         <xsd:complexType name="AuthenticationInfo">
            <xsd:sequence>
               <xsd:element name="userName" type="xsd:string" />
               <xsd:element name="password" type="xsd:string" />
               <xsd:element minOccurs="0" name="authentication" type="xsd:string" />
               <xsd:element minOccurs="0" name="locale" type="xsd:string" />
               <xsd:element minOccurs="0" name="timeZone" type="xsd:string" />
            </xsd:sequence>
         </xsd:complexType>
      </xsd:schema>
   </wsdl:types>
   <wsdl:message name="ARAuthenticate">
      <wsdl:part element="s0:AuthenticationInfo" name="parameters" />
   </wsdl:message>
   <wsdl:message name="New_Create_Operation_0SoapOut">
      <wsdl:part element="s0:New_Create_Operation_0Response" name="parameters" />
   </wsdl:message>
   <wsdl:message name="New_Create_Operation_0SoapIn">
      <wsdl:part element="s0:New_Create_Operation_0" name="parameters" />
   </wsdl:message>
   <wsdl:portType name="New_Port_0PortType">
      <wsdl:operation name="New_Create_Operation_0">
         <wsdl:input message="s0:New_Create_Operation_0SoapIn" />
         <wsdl:output message="s0:New_Create_Operation_0SoapOut" />
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="New_Port_0SoapBinding" type="s0:New_Port_0PortType">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
      <wsdl:operation name="New_Create_Operation_0">
         <soap:operation soapAction="urn:ISS_WS_Test1/New_Create_Operation_0" style="document" />
         <wsdl:input>
            <soap:header message="s0:ARAuthenticate" part="parameters" use="literal" />
            <soap:body use="literal" />
         </wsdl:input>
         <wsdl:output>
            <soap:body use="literal" />
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="ISS_WS_Test1Service">
      <wsdl:port binding="s0:New_Port_0SoapBinding" name="New_Port_0Soap">
         <soap:address location="http://remotesrm/arsys/services/ARService?server=remotesrm&amp;webService=ISS_WS_Test1" />
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>
 
using without  gray font...
also:
1. In midtier config tool, enable web service user
2. Add this user to Remedy 

here is example of javascript soap request:


function soap() {
  var xmlhttp = new XMLHttpRequest();
  xmlhttp.open('POST', '/arsys/services/ARService?server=remotesrm&webService=ISS_WS_RenewPassword', true);
 
  // build SOAP request
  var sr =
  '<?xml version="1.0" encoding="utf-8"?>' +
  '<soapenv:Envelope ' + 
    'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" ' +
    'xmlns:urn="urn:ISS_WS_RenewPassword">' +
    '<soapenv:Header/>'+
    '<soapenv:Body>' +
      '<urn:RenewPassword>' +
      '<urn:userEmail>'+ document.getElementById('userEmail').value + '</urn:userEmail>'+
      '</urn:RenewPassword>'+
      '</soapenv:Body>' +
  '</soapenv:Envelope>';
 
  xmlhttp.onreadystatechange = function () {
    if (xmlhttp.readyState == 4) {
      if (xmlhttp.status == 200) {
        console.log('debug output');
      }
    }
  }
  // Send the POST request
  xmlhttp.setRequestHeader('Content-Type', 'text/xml');
  xmlhttp.setRequestHeader('SOAPAction', 'urn:ISS_WS_RenewPassword/RenewPassword');
  xmlhttp.send(sr);
}