Search This Blog

Lets go..




Manage your Inventory | Grow your restaurant business | Manage your Employee | Control your accounts
Showing posts with label SOAP Security. Show all posts
Showing posts with label SOAP Security. Show all posts

Thursday

How to Create Web service and Consume web service in Web page


By: Mohammad Tuaha
How to Create Web service and Consume web service in Web page.

Or Create web service and consume web service

Requirement 
Visual Studio 2010 - up-to
 
Step 1: First create a website.
Step 2: Add new item web service file extension is .asmx

Step 3: In App_code Folder has à NewWebService_tut_1.cs file is the main web service operation file
Here is web service Method
  [WebMethod]
    public double Add(double x, double y)
    {
        return (x + y);
    }

    [WebMethod]
    public double Subtract(double x, double y)
    {
        return x - y;
    }

    [WebMethod]
    public double Multiply(double x, double y)
    {
        return x * y;
    }
It’s simple web service function. Now it’s ready to use Just build and RUN F5.
In my web service has two parameter one is X second is Y
Output is

How use it’s on web page
Step 4:
Open a new web project and add web reference.
Copy the web service url 
Add web Reference ànd paste Link into URL textbox


Step 5:
Now add two textbox and a button in Default.aspx page.

  protected void btnValueCalculation_Click(object sender, EventArgs e)
    {
        if (txtValue1.Text != string.Empty     && txtValue2.Text != string.Empty)
        {
            try
            {
                int x = Convert.ToInt32(txtValue1.Text);
                int y = Convert.ToInt32(txtValue2.Text);                               

              
                NewService.NewWebService_tut_1 service = new NewService.NewWebService_tut_1();
                lblAdd.Text = "Sum: " + service.Add(x, y).ToString();   
                lblSub.Text = "Difference: " + service.Subtract(x, y).ToString();
                lblmul.Text = "Multiplication: " + service.Multiply(x, y).ToString();
                lbldiv.Text = "Divide: " + service.Divide(x, y).ToString();
            }
            catch (Exception)
            {
                lblAdd.Text = "Please Fill Value ";
                  // Tuaha mohammad
            }
        }
    }

Now run your web project. User can use this web service any web platform any language like PHP ,jsp Asp 

Download Project

Next one is how to create web service with Database 



Wednesday

Securing soap web service with Spring-WS using Wss4jSecurityInterceptor (Part-3 Client Part)

Sorry for late.
Description add later. Just follow this document.
http://docs.spring.io/spring-ws/site/reference/html/security.html 
I have just followed this article and writing code according to the instruction.
Complete source code download from bellow link:
https://www.dropbox.com/s/7bm6rgsmnozswyj/SecureSpringClient.zip?dl=0

If you will face any problem to run this code, feel free to  mail.
Please note that you must delete build folder from project and clean and build using Netbeans IDE again.

Thanks
Md Mahfuj Jia
Happy Coding...


Securing soap web service with Spring-WS using Wss4jSecurityInterceptor (Part-2 Server Part)

Sorry for late.
Description add later. Just follow this document.
http://docs.spring.io/spring-ws/site/reference/html/security.html 
I have just followed this article and writing code according to the instruction.
Complete source code download from bellow link:
https://www.dropbox.com/s/8pxx7mh8ljtpjkk/SecureSpringWS.zip?dl=0

If you will face any problem to run this code, feel free to  mail.

Thanks
Md Mahfuj Jia
Happy Coding...