Neue Statusberichte abholen
SOAP 1.1
Es folgt ein Beispiel für eine SOAP 1.1-Anforderung und -Antwort. Die angezeigten Platzhalter müssen durch tatsächliche Werte ersetzt werden.
POST /gateway/Information.asmx HTTP/1.1 Host: www.smscreator.de Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://www.smscreator.de/gateway/QueryReceivedNewDLR" <?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> <QueryReceivedNewDLR xmlns="http://www.smscreator.de/gateway"> <User>string</User> <Password>string</Password> </QueryReceivedNewDLR> </soap:Body> </soap:Envelope>
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> <QueryReceivedNewDLRResponse xmlns="http://www.smscreator.de/gateway"> <QueryReceivedNewDLRResult> <StatusCode>None or Ok or InvalidUser or AccountLocked or IPLock or DatabaseError</StatusCode> <Value> <SMSReport> <Recipient>string</Recipient> <JobId>int</JobId> <Status>string</Status> <Date>dateTime</Date> <MsgCode>int</MsgCode> <MsgText>string</MsgText> <DoneDate>dateTime</DoneDate> <DoneDateTimeZoneOffset>int</DoneDateTimeZoneOffset> <Sequence>int</Sequence> <Caption>string</Caption> </SMSReport> <SMSReport> <Recipient>string</Recipient> <JobId>int</JobId> <Status>string</Status> <Date>dateTime</Date> <MsgCode>int</MsgCode> <MsgText>string</MsgText> <DoneDate>dateTime</DoneDate> <DoneDateTimeZoneOffset>int</DoneDateTimeZoneOffset> <Sequence>int</Sequence> <Caption>string</Caption> </SMSReport> </Value> </QueryReceivedNewDLRResult> </QueryReceivedNewDLRResponse> </soap:Body> </soap:Envelope>
SOAP 1.2
Es folgt ein Beispiel für eine SOAP 1.2-Anforderung und -Antwort. Die angezeigten Platzhalter müssen durch tatsächliche Werte ersetzt werden.
POST /gateway/Information.asmx HTTP/1.1 Host: www.smscreator.de Content-Type: application/soap+xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <QueryReceivedNewDLR xmlns="http://www.smscreator.de/gateway"> <User>string</User> <Password>string</Password> </QueryReceivedNewDLR> </soap12:Body> </soap12:Envelope>
HTTP/1.1 200 OK Content-Type: application/soap+xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <QueryReceivedNewDLRResponse xmlns="http://www.smscreator.de/gateway"> <QueryReceivedNewDLRResult> <StatusCode>None or Ok or InvalidUser or AccountLocked or IPLock or DatabaseError</StatusCode> <Value> <SMSReport> <Recipient>string</Recipient> <JobId>int</JobId> <Status>string</Status> <Date>dateTime</Date> <MsgCode>int</MsgCode> <MsgText>string</MsgText> <DoneDate>dateTime</DoneDate> <DoneDateTimeZoneOffset>int</DoneDateTimeZoneOffset> <Sequence>int</Sequence> <Caption>string</Caption> </SMSReport> <SMSReport> <Recipient>string</Recipient> <JobId>int</JobId> <Status>string</Status> <Date>dateTime</Date> <MsgCode>int</MsgCode> <MsgText>string</MsgText> <DoneDate>dateTime</DoneDate> <DoneDateTimeZoneOffset>int</DoneDateTimeZoneOffset> <Sequence>int</Sequence> <Caption>string</Caption> </SMSReport> </Value> </QueryReceivedNewDLRResult> </QueryReceivedNewDLRResponse> </soap12:Body> </soap12:Envelope>
HTTP GET
Folgendes ist eine Beispielanforderung und -antwort für HTTP GET. Die angezeigten Platzhalter müssen durch richtige Werte ersetzt werden.
GET /gateway/Information.asmx/QueryReceivedNewDLR?User=string&Password=string HTTP/1.1 Host: www.smscreator.de
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <SOAPResponseOfListOfSMSReport xmlns="http://www.smscreator.de/gateway"> <StatusCode>None or Ok or InvalidUser or AccountLocked or IPLock or DatabaseError</StatusCode> <Value> <SMSReport> <Recipient>string</Recipient> <JobId>int</JobId> <Status>string</Status> <Date>dateTime</Date> <MsgCode>int</MsgCode> <MsgText>string</MsgText> <DoneDate>dateTime</DoneDate> <DoneDateTimeZoneOffset>int</DoneDateTimeZoneOffset> <Sequence>int</Sequence> <Caption>string</Caption> </SMSReport> <SMSReport> <Recipient>string</Recipient> <JobId>int</JobId> <Status>string</Status> <Date>dateTime</Date> <MsgCode>int</MsgCode> <MsgText>string</MsgText> <DoneDate>dateTime</DoneDate> <DoneDateTimeZoneOffset>int</DoneDateTimeZoneOffset> <Sequence>int</Sequence> <Caption>string</Caption> </SMSReport> </Value> </SOAPResponseOfListOfSMSReport>
HTTP POST
Folgendes ist eine Beispielanforderung und -antwort für HTTP POST. Die angezeigten Platzhalter müssen durch richtige Werte ersetzt werden.
POST /gateway/Information.asmx/QueryReceivedNewDLR HTTP/1.1 Host: www.smscreator.de Content-Type: application/x-www-form-urlencoded Content-Length: length User=string&Password=string
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <SOAPResponseOfListOfSMSReport xmlns="http://www.smscreator.de/gateway"> <StatusCode>None or Ok or InvalidUser or AccountLocked or IPLock or DatabaseError</StatusCode> <Value> <SMSReport> <Recipient>string</Recipient> <JobId>int</JobId> <Status>string</Status> <Date>dateTime</Date> <MsgCode>int</MsgCode> <MsgText>string</MsgText> <DoneDate>dateTime</DoneDate> <DoneDateTimeZoneOffset>int</DoneDateTimeZoneOffset> <Sequence>int</Sequence> <Caption>string</Caption> </SMSReport> <SMSReport> <Recipient>string</Recipient> <JobId>int</JobId> <Status>string</Status> <Date>dateTime</Date> <MsgCode>int</MsgCode> <MsgText>string</MsgText> <DoneDate>dateTime</DoneDate> <DoneDateTimeZoneOffset>int</DoneDateTimeZoneOffset> <Sequence>int</Sequence> <Caption>string</Caption> </SMSReport> </Value> </SOAPResponseOfListOfSMSReport>
Beispiel
function PostToHost($host, $path, $data_to_send) { // Verwendet HTTPS $fp = fsockopen('ssl://' . $host, 443); fputs($fp, "POST $path HTTP/1.1\r\n"); fputs($fp, "Host: $host\r\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-length: ". strlen($data_to_send) ."\r\n"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, $data_to_send); $res = ""; while(!feof($fp)) { $res .= fgets($fp, 128); } fclose($fp); return $res; } function QueryReceivedNewDLR($user,$pw) { // Vorbereiten der Daten $data = "User=$user&Password=$pw"; // Senden an den Server $x = PostToHost("www.smscreator.de","/gateway/Information.asmx/QueryReceivedNewDLR", $data); // Auswerten des Ergebnisses return "Status: " . ParseXML($x,"StatusCode") . "<br>Value: " .ParseXML($x,"Value"); } function ParseXML($msg,$token) { $iStart = strpos($msg,"<" . $token . ">") + strlen($token) +2; $y = substr($msg,$iStart); $iEnde = strpos($y,"</". $token . ">"); return substr($y,0,$iEnde); }
SOAP
sub queryReceivedNewDLR { my $soap = SOAP::Lite -> uri(URI) -> proxy('http://www.smscreator.de/gateway/Information.asmx') -> encoding('utf-8') -> on_action(sub{sprintf '%s/%s', @_ }) ; my $User = SOAP::Data->name('User' => SERIENNUMMER)->type(''); my $Pw = SOAP::Data->name('Password' => PASSWORT)->type(''); my $result = $soap->call (SOAP::Data->name ('QueryReceivedNewDLR')->attr ({xmlns => URI}), ($User,$Pw)); unless ($result->fault) { my $rv = $result->result(); return(0,$rv); } else { my $str = join ', ', $result>faultcode, $result->faultstring, $result->faultdetail; return(-1, $str); } }
Beispiel
<html> <body> <%@ Page AspCompat=true %> <% Response.Buffer = True Dim User Dim Password User = "test" Password = "test" Dim xml, text,strURL xml = Server.CreateObject("Microsoft.XMLHTTP") 'Or if this doesn't work then try : 'Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP") strURL = "http://www.smscreator.de/gateway/Information.asmx/QueryReceivedNewDLR" strURL = strUrl & "?User=" & Server.URLEncode(User) strURL = strURL & "&Password=" & Server.UrlEncode(Password) xml.Open("GET", strURL, False) xml.Send text = xml.ResponseText Response.write(text) xml = Nothing %> </body> </html>
Borland6 TNM HTTP
AnsiString sUrl = "/gateway/Information.asmx/QueryReceivedNewDLR?"; sUrl += "User=" + URLEncode(edUser->Text); sUrl += "&Password=" + URLEncode(edPassword->Text); NMHTTP1->Host = "www.smscreator.de"; NMHTTP1->Get(sUrl); AnsiString sReturn = NMHTTP1->Body; mAntwort->Text = sReturn;
Java Modul (axis1)
public void queryReceivedNewDLR() throws Exception { InputStreamReader isr = new InputStreamReader(System.in, Charset.forName("ISO-8859-1")); BufferedReader input = new BufferedReader(isr); System.out.print("User: "); String user = input.readLine().trim(); System.out.print("Password: "); String pw = input.readLine().trim(); try { System.out.println("Querying received new DLR"); de.smscreator.www.gateway.Information service = new de.smscreator.www.gateway.InformationLocator(); de.smscreator.www.gateway.InformationSoap informationSoap = service.getInformationSoap(); de.smscreator.www.gateway.QueryReceivedNewDLRResponse res = informationSoap.queryReceivedNewDLR(new de.smscreator.www.gateway.QueryReceivedNewDLR(user, pw)); de.smscreator.www.gateway.SOAPResponseOfListOfSMSReport soapRes = res.getQueryReceivedNewDLRResult(); System.out.println("Status: " + soapRes.getStatusCode()); System.out.println("NumberOfReports: " + soapRes.getValue().length); } catch (Exception ex) { System.out.println("Error while querying received new DLR: " + ex.getMessage()); } }
Beispiel
Try Dim mySend As New de.smscreator.www.Information Dim myResult As de.smscreator.www.SOAPResponseOfListOfSMSReport myResult = mySend.QueryReceivedNewDLR(txtUser.Text, txtPassword.Text) If myResult.StatusCode <> de.smscreator.www.LoginStatus.Ok Then MessageBox.Show("Status: " & myResult.StatusCode) Else MessageBox.Show("Number of DLR: " & myResult.Value.Length) End If Catch ex As Exception MessageBox.Show("Error: " & ex.Message) End Try
Beispiel
Function GetRecivedNewDLR(user, password) Dim oweb Set oweb = CreateObject("MSXML2.XMLHTTP") Dim url dim dataparam ' To enable Secure Transmission use https url = "https://www.smscreator.de/GATEWAY/Information.asmx/QueryReceivedNewDLR" dataparam = "User=" & user & "&Password=" & password oweb.Open "Post", url, False oweb.setRequestHeader "Content-type", "application/x-www-form-urlencoded" oweb.setRequestHeader "Content-length", len(dataparam) oweb.setRequestHeader "Connection", "close" oweb.send dataparam GetRecivedNewDLR = ParseResultAccount(oweb.responseXML.XML) End Function ' Parse the Result an returns Number of new DLR or -1 if an error Function ParseResultAccount(strresult) Dim ores Set ores = CreateObject("MSXML2.DOMDocument") ores.LoadXML strresult If UCase(ores.getElementsByTagName("StatusCode").Item(0).Text) = "OK" Then ParseResultAccount = ores.getElementsByTagName("Value").Item(0).childNodes.length Else ' To Show the Error Debug.Print strresult ParseResult = -1 End If End Function
Beispiel
try { de.smscreator.www.SOAPResponseOfListOfSMSReport sResult = myInfo.QueryReceivedNewDLR(txtUser.Text, txtPass.Text); if (sResult.StatusCode != de.smscreator.www.LoginStatus.Ok) { MessageBox.Show("Status: " + sResult.StatusCode); } else { MessageBox.Show("Number of new DLR: " + sResult.Value.Length); } } catch (Exception ee) { MessageBox.Show("Error: " + ee.Message); }
Beispiel
#!/usr/bin/env ruby # ---------------------------------------------------------------------------- # "THE BEER-WARE LICENSE" (Revision 42): # <marius@nuenneri.ch> wrote this file. As long as you retain this notice you # can do whatever you want with this stuff. If we meet some day, and you think # this stuff is worth it, you can buy me a beer in return. Marius Nuennerich # ---------------------------------------------------------------------------- require 'optparse' require 'uri' require 'net/http' require 'active_support/core_ext/hash' options = {} OptionParser.new do |opts| opts.on("-u USERNAME", "", "Login username") do |o| options[:user] = o end opts.on("-p PASSWORD", "", "Login password") do |o| options[:password] = o end end.parse! user = URI.escape "test" password = URI.escape "test" uri = "http://www.smscreator.de/gateway/Information.asmx/QueryReceivedNewDLR?" + "User=#{user}&Password=#{password}" res = Net::HTTP.get(URI.parse(uri)) hash = Hash.from_xml(res) status = hash["SOAPResponseOfListOfSMSReport"]["StatusCode"] value = hash["SOAPResponseOfListOfSMSReport"]["Value"] puts "Loginstatus: " + status if value puts "Value: " + value end
python
#!/usr/bin/python2.5 import urllib2 import urllib import ssl import time send_ret = '' ret_status = False sms_baseurl = 'https://www.smscreator.de/gateway/Information.asmx/QueryReceivedNewDLR' sms_user = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx' sms_pass = 'xxxxxxxxxxxxxxxxx' request_map = { 'User': sms_user, 'Password': sms_pass} txdata = urllib.urlencode(request_map) txheaders = {} try: filehandle = urllib2.urlopen(sms_baseurl, txdata) send_ret = filehandle.read() filehandle.close() ret_status = True except Exception, e: print 'Error happend: %s'%str(e) if ret_status: from xml.dom import minidom xmldoc = minidom.parseString(send_ret) status = xmldoc.getElementsByTagName('StatusCode')[0] value = xmldoc.getElementsByTagName('Value')[0] print 'StatusCode: {0}'.format(status.firstChild.data) print 'Return: {0}'.format(send_ret) else: print 'Querying Received New DLR failed.' print 'Return data: %s' % str(send_ret)
python3
#!/usr/bin/python3.2 import urllib.request, urllib.error, urllib.parse import urllib.request, urllib.parse, urllib.error import ssl import time send_ret = '' ret_status = False sms_baseurl = 'https://www.smscreator.de/gateway/Information.asmx/QueryReceivedNewDLR' sms_user = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx' sms_pass = 'xxxxxxxxxxxxxxxxx' request_map = { 'User': sms_user, 'Password': sms_pass } txdata = urllib.parse.urlencode(request_map) txdata = txdata.encode("utf-8") txheaders = {} try: filehandle = urllib.request.urlopen(sms_baseurl, txdata) send_ret = filehandle.read() filehandle.close() ret_status = True except Exception as e: print('Error happend: %s'%str(e)) if ret_status: from xml.dom import minidom xmldoc = minidom.parseString(send_ret) status = xmldoc.getElementsByTagName('StatusCode')[0] value = xmldoc.getElementsByTagName('Value')[0] print('StatusCode: {0}'.format(status.firstChild.data)) else: print('Querying Received New DLR failed.') print('Return data: %s' % str(send_ret))
Rufen Sie uns an.
Lösungen finden