Please help with the following task:
The client types an sms to the number 3333 on his mobile,the name of the product(for example: apples); these goes to the mobile operator, which send to our company the following(what we receive):
$xml = SOAP:
ata->name('sms' => \SOAP:
ata->value(
SOAP:
ata->name('id' => '3432424324324'),
SOAP:
ata->name('source' => '04576534'),
SOAP:
ata->name('destination' => '3333'),
SOAP:
ata->name('text' =>'apples')));
I have to verify if in our database if there is such a product and to answer to them : 'not' or 'yes'
So I created the the server:
use DBI;
use SOAP::Transport::HTTP;
SOAP::Transport::HTTP::CGI
-> dispatch_to('class')
-> handle;
package class;
sub sms {
my $class = shift;
my $envelope = pop;
my $text= SOAP:
ata->name('text'=>$envelope->{'text'});
my $server = '';
my $db = '';
my $username = '' ;
my $password = '' ;
my $dbh = DBI->connect("dbi:mysql:$db:$server", $username, $password, { RaiseError => 1 });
$query="select product from table where product_name='$envelope->{'text'}' ";
$sth=$dbh->prepare($query) ;
$sth->execute();
if ($sth->rows)
{
$text=$envelope->{'text'}."Yes";
}else{
$text=$envelope->{'text'}."Not";
}
return $text;
}
exit;
So this is my server.
no I have to create the client to send to them the response.
I received from mobile operator the parametres which i should use in my clent:
public: 122.23.453.721
incoming: 112.10.231.150
Their ProviderID: {234y53ob-tt5d-2g4u-862b-78s0134k38r4}
Their xml example:
POST /soap/smsgate.asmx HTTP/1.1
Host: Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi=" xmlns:xsd=" xmlns:soap="<soap:Body>
<Process xmlns="<providerId>string</providerId>
<xml>string</xml>
</Process>
</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=" xmlns:xsd=" xmlns:soap="<soap:Body>
<ProcessResponse xmlns="<ProcessResult>int</ProcessResult>
</ProcessResponse>
</soap:Body>
</soap:Envelope>
How to make my client acording their paramatres to sent them the answer.
Please help.
The client types an sms to the number 3333 on his mobile,the name of the product(for example: apples); these goes to the mobile operator, which send to our company the following(what we receive):
$xml = SOAP:
SOAP:
SOAP:
SOAP:
SOAP:
I have to verify if in our database if there is such a product and to answer to them : 'not' or 'yes'
So I created the the server:
use DBI;
use SOAP::Transport::HTTP;
SOAP::Transport::HTTP::CGI
-> dispatch_to('class')
-> handle;
package class;
sub sms {
my $class = shift;
my $envelope = pop;
my $text= SOAP:
my $server = '';
my $db = '';
my $username = '' ;
my $password = '' ;
my $dbh = DBI->connect("dbi:mysql:$db:$server", $username, $password, { RaiseError => 1 });
$query="select product from table where product_name='$envelope->{'text'}' ";
$sth=$dbh->prepare($query) ;
$sth->execute();
if ($sth->rows)
{
$text=$envelope->{'text'}."Yes";
}else{
$text=$envelope->{'text'}."Not";
}
return $text;
}
exit;
So this is my server.
no I have to create the client to send to them the response.
I received from mobile operator the parametres which i should use in my clent:
public: 122.23.453.721
incoming: 112.10.231.150
Their ProviderID: {234y53ob-tt5d-2g4u-862b-78s0134k38r4}
Their xml example:
POST /soap/smsgate.asmx HTTP/1.1
Host: Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi=" xmlns:xsd=" xmlns:soap="<soap:Body>
<Process xmlns="<providerId>string</providerId>
<xml>string</xml>
</Process>
</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=" xmlns:xsd=" xmlns:soap="<soap:Body>
<ProcessResponse xmlns="<ProcessResult>int</ProcessResult>
</ProcessResponse>
</soap:Body>
</soap:Envelope>
How to make my client acording their paramatres to sent them the answer.
Please help.