Skip to the content

Kontingent abfragen

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/QueryAccountBalance"

<?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>
    <QueryAccountBalance xmlns="http://www.smscreator.de/gateway">
        <User>string</User>
        <Password>string</Password>
    </QueryAccountBalance>
    </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>
    <QueryAccountBalanceResponse xmlns="http://www.smscreator.de/gateway">
        <QueryAccountBalanceResult>
        <StatusCode>None or Ok or InvalidUser or AccountLocked or IPLock or DatabaseError</StatusCode>
        <Value>double</Value>
        </QueryAccountBalanceResult>
    </QueryAccountBalanceResponse>
    </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>
    <QueryAccountBalance xmlns="http://www.smscreator.de/gateway">
        <User>string</User>
        <Password>string</Password>
    </QueryAccountBalance>
    </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>
    <QueryAccountBalanceResponse xmlns="http://www.smscreator.de/gateway">
        <QueryAccountBalanceResult>
        <StatusCode>None or Ok or InvalidUser or AccountLocked or IPLock or DatabaseError</StatusCode>
        <Value>double</Value>
        </QueryAccountBalanceResult>
    </QueryAccountBalanceResponse>
    </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/QueryAccountBalance?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"?>
<SOAPResponseOfDouble xmlns="http://www.smscreator.de/gateway">
    <StatusCode>None or Ok or InvalidUser or AccountLocked or IPLock or DatabaseError</StatusCode>
    <Value>double</Value>
</SOAPResponseOfDouble>
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/QueryAccountBalance 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"?>
<SOAPResponseOfDouble xmlns="http://www.smscreator.de/gateway">
    <StatusCode>None or Ok or InvalidUser or AccountLocked or IPLock or DatabaseError</StatusCode>
    <Value>double</Value>
</SOAPResponseOfDouble>

 

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 QueryAccount($user,$pw) 
{ 
	// Vorbereiten der Daten 
	$data = "User=$user&Password=$pw"; 

// Senden an den Server 
	$x = PostToHost("www.smscreator.de","/gateway/Information.asmx/QueryAccountBalance", $data); 
	// Auswerten des Ergebnisses 
	return "Status: " . ParseXML($x,"StatusCode") . "<br>SMSCredits: " .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 queryAccount
{
    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 ('QueryAccountBalance')->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>
<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/QueryAccountBalance"

    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  = "/Send.asmx/QueryBalance?";
sUrl += "User=" + URLEncode(edUser->Text);
sUrl += "&Password=" + URLEncode(edPassword->Text);

NMHTTP1->Host = "soap.smscreator.de";
NMHTTP1->Get(sUrl);


AnsiString sReturn =   NMHTTP1->Body;

mAntwort->Text = sReturn;
Borland6 WSDL Import
_di_SendSoap soap = GetSendSoap(false,"");

AnsiString sReturn = soap->QueryBalance(
    edUser->Text
    ,edPassword->Text
);

mAntwort->Text = sReturn;

 

Java Modul (axis1)
public void queryAccount() 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 account");
        
        de.smscreator.www.gateway.Information service = new de.smscreator.www.gateway.InformationLocator();
        de.smscreator.www.gateway.InformationSoap informationSoap = service.getInformationSoap();
        de.smscreator.www.gateway.QueryAccountBalanceResponse res = informationSoap.queryAccountBalance(new de.smscreator.www.gateway.QueryAccountBalance(user, pw));

        de.smscreator.www.gateway.SOAPResponseOfDouble soapRes = res.getQueryAccountBalanceResult();
        
        System.out.println("Status: " + soapRes.getStatusCode());
        System.out.println("SmsCredits: " + soapRes.getValue());
    }
    catch (Exception ex) {
        System.out.println("Error while querying account: " + ex.getMessage());			
    }
}

 

Form1.vb
Try

    Dim mySend As New de.smscreator.www.Information
    Dim myResult As de.smscreator.www.SOAPResponseOfDouble

    REM Simple Send Message to Server
    myResult = mySend.QueryAccountBalance(txtUser.Text, txtPassword.Text)
    MessageBox.Show("Account: " & myResult.Value)

Catch ex As Exception
    MessageBox.Show("Error: " & ex.Message)
End Try

 

QueryAccount.vbs
Function GetAccount(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/QueryAccountBalance"
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

GetAccount = ParseResultAccount(oweb.responseXML.XML)
End Function

' Parse the Result an returns JobId 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).Text
Else
    ' To Show the Error
    Debug.Print strresult
    ParseResult = -1
End If
End Function

 

frmSendSMS.cs
try
{
    de.smscreator.www.SOAPResponseOfDouble sResult = myInfo.QueryAccountBalance(txtUser.Text, txtPass.Text);
    if (sResult.StatusCode != de.smscreator.www.LoginStatus.Ok)
    {
        MessageBox.Show("Status: " + sResult.StatusCode);
    }
    else
    {
        MessageBox.Show("Balance: " + sResult.Value);
    }
}
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 options[:user]
password  = URI.escape options[:password]

uri = "http://www.smscreator.de/gateway/Information.asmx/QueryAccountBalance?" +
        "User=#{user}&Password=#{password}"

res = Net::HTTP.get(URI.parse(uri))

hash = Hash.from_xml(res)
status = hash["SOAPResponseOfDouble"]["StatusCode"]
value = hash["SOAPResponseOfDouble"]["Value"]

puts "Status: " + status + "\tSMSCredits: " + value

 

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/QueryAccountBalance'
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:
#	print 'Status: SMS to %s send succeeded.' % str(sms_recipient)
#else:
#	print 'Status: SMS to %s send failed.' % str(sms_recipient)

from xml.dom import minidom
xmldoc = minidom.parseString(send_ret)
item = xmldoc.getElementsByTagName('Value')[0]

print 'SMSCredits: {0}'.format(item.firstChild.data)

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/QueryAccountBalance'
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)
    item = xmldoc.getElementsByTagName('Value')[0]

    print('SMSCredits: {0}'.format(item.firstChild.data))
else:
    print('Querying Account Balance failed.')

print('Return data: %s' % str(send_ret))

 

main.pas
var
    sResult: string;
begin

    try
    sResult:= (HTTPRIO1 as SendSoap).QueryBalance2(WideString(User_Edit.Text), WideString(Pw_Edit.Text));
    if Pos('ERROR', Uppercase(sResult)) = 0 then
    begin
        Status_Panel.Font.Color:= clLime;
        Status_Panel.Caption:= sResult;
    end
    else
    begin
        Status_Panel.Font.Color:= clRed;
        Status_Panel.Caption:= 'ERROR';
    end;
    DoAddLogMemo(sResult);
    except
        on E: Exception do
        begin
        DoAddLogMemo('General Error -' + E.Message);
        Status_Panel.Font.Color:= clRed;
        Status_Panel.Caption:= 'ERROR';
        end;
    end;

end;

 

Rufen Sie uns an.

Lösungen finden

Lassen Sie sich unverbindlich von unseren Experten der Netxp beraten! Wir finden die Lösung für Ihre Anforderungen.
Schnell -  Präzise - Zuverlässig.