Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help!!! please with Perl Soap task

Status
Not open for further replies.

vicf

Programmer
Oct 10, 2007
2
MD
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::Data->name('sms' => \SOAP::Data->value(
SOAP::Data->name('id' => '3432424324324'),
SOAP::Data->name('source' => '04576534'),
SOAP::Data->name('destination' => '3333'),
SOAP::Data->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::Data->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.
 
Could you explain how far you have got? What does your current script do, and what is it that it doesn't do that you need it to do? I have had a look into using SOAP::Data
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top