Solved

How to Convert an SNPP request to HTTP request

Posted on 2001-08-22
15
533 Views
Last Modified: 2008-03-10
Hi Experts,

   I have a serlvet which process an HTTP request, but the request which i'm goin to receive is off SNPP.

But we don't have an SNPP server to get the request,so how do am I process the SNPP request?

Is there any way to convert an SNPP request to HTTP or any way to write a code so that it could accept the SNPP request??

Similarly the response should be sent is off SNPP.

Can U experts provide sample code or sites on this.

Waiting for Ur reply...
0
Comment
Question by:Tension
  • 7
  • 3
  • 3
  • +2
15 Comments
 
LVL 92

Expert Comment

by:objects
Comment Utility
I'm confused.
Do you want to know how to make a HTTP server accept SNPP requests?
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
You can certainly send and recieve SNPP using a servlet but the SNPP packets will need to wrapped in a HTTP packet.
0
 

Author Comment

by:Tension
Comment Utility
Hi objects,

   Thankx for Ur reply.

So how it could be done [SNPP packets will need to wrapped in a HTTP packet.]

Can U explain me in a detail manner?

0
 
LVL 92

Expert Comment

by:objects
Comment Utility
It depends on what you're trying to do.
Can u explain in a bit more detail what you want to do?



0
 

Author Comment

by:Tension
Comment Utility

Sorry, the protocol is off SMPP.

Actually a request is made from a mobile phone to know the stock status [AOL] which would be send to the cellular provider.

The provider then sends the redirects the request came from the mobile user [MobileNumber & StockName] which in the form of SMPP request.

We have a servlet which is based on HTTP request [Handle HTTP Request]which is goin to process the mobile request.

So how could the process been done to wrap SMPP packet to HTTP packet.So that the servlet could process the request & send the appropriate info. [Reverse should also be done, again from HTTP packets to SMPP packets so that the provider is able to get the response from the servlet & can be give to appropriate mobile user].

0
 
LVL 92

Expert Comment

by:objects
Comment Utility
You need to have an SMPP server to recieve SMPP requests, web server is expecting HTTP packets and wouldn't know what to do with an SMPP packet.

Your servlet could certainly send SMPP packets use a socket connection with a SMPP server.
0
 
LVL 3

Expert Comment

by:sghosh092199
Comment Utility
Hi!

You can do the same in the following way:

Step 1: Parse the SMPP Packet and get the stock symbol


Step 2: Open a connection to the Servlet URL and provide the symbol information

try
          {
          URL url = new URL("http://smpp.domain.com/StockServlet");
          URLConnection connection = url.openConnection();
          connection.setDoOutput(true);

          PrintWriter out = new PrintWriter(
                              connection.getOutputStream());
          out.println("stock=" + stockSymbol);
          out.close();

Step 3: Read the information from Servet

          BufferedReader in = new BufferedReader(
                    new InputStreamReader(
                    connection.getInputStream()));
          String inputLine;

          while ((inputLine = in.readLine()) != null)
              System.out.println(inputLine);

          in.close();
   
          }
          catch (MalformedURLException e)
          {
          e.printStackTrace();
          }
          catch (IOException e)
          {
          e.printStackTrace();
          }




Step 4: Create a SMPP Packet incorporating information available from Servlet and connect to SMPP Server.


Hope that helps!
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 92

Expert Comment

by:objects
Comment Utility
> Step 1: Parse the SMPP Packet and get the stock symbol

How do you recieve the SMPP packet though?
0
 
LVL 3

Expert Comment

by:sghosh092199
Comment Utility
As you have said, the servlet could certainly send SMPP packets with a socket connection to a SMPP server. Similarly, a socket connection can read from the Server too. I assume that it is a stream of bytes which can be parsed following the packet specifications.

0
 
LVL 92

Expert Comment

by:objects
Comment Utility
> Similarly, a socket connection can read from the Server

But the server does not need to queried for the SMPP packet.
It is sending out SMPP packets, to (I assume) some address which needs to be an SMPP server.
Servets recieve requests thru the web server which supports HTTP.
0
 

Author Comment

by:Tension
Comment Utility
Hi All!!
 
    Actually process is,the service provider accepts the request from the mobile user and provider redirects the request[is Off SMPP] to our servlet which is off [HTTP based].

sqhosh says that we can make a URL connection,I couldn't get this,Becoz the URL connection is made to a servlet.U mean to say that we have to query the SMPP server for getting the request?? how could it be done?

Becoz as objects says is correct, that he sends the request which is off SMPP to a servlet which supports HTTP.

sqhosh can U explain me bit more detail!!  
0
 
LVL 3

Assisted Solution

by:sghosh092199
sghosh092199 earned 100 total points
Comment Utility
The Java application which is responsible for converting SMPP Request to HTTP Request, is mediating between the provider and the HTTP based Servlet.The SMPP Packets should be made available to this Java application. It can be done by opening a Socket and intercepting the output port in the SMPP Server, which is sending out SMPP request .

The idea behind opening a URL Connection to the Servlet is making a HTTP Request to the Servlet from the Java application. Web Server does make HTTP Requests to Servlet. But this scenario does not allow a Web Server to do so.

Hope I am bit clear!
0
 
LVL 92

Accepted Solution

by:
objects earned 100 total points
Comment Utility
> The Java application which is responsible for converting
> SMPP Request to HTTP Request

And as I said above you need to write an SMPP server.
0
 

Expert Comment

by:CleanupPing
Comment Utility
Tension:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 20

Expert Comment

by:Venabili
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Split points between objects and sghosh

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Venabili
EE Cleanup Volunteer
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now