PB calls WebService

Source: Internet
Author: User
ArticleDirectory
    •  

Speaking of PowerBuilder, everyone may sneer at it and then say, "What about it, buddy "? I remember the movie "Kung Fu pandatv" said: it is reasonable to exist. I want to say that if this thing or it exists in the world, it must have its own truth. It seems to be a little far away ....

Well, back to the truth, PowerBuilder was still very popular before net became a trend. Therefore, some companies are still using it for development. Someone asked why not change it. The situations of each company are different. There is always one or another reason that cannot be changed. We will not study this.

Currently, WebService is very popular. If they are combined, for example, WebService written in net is called by Pb, and can also be published as an interface and called by other companies, why not?

Let's talk about it first.Development Environment:32Bits win7Flagship edition + pb11.5

In fact, WebService can be called when pb10.0 is released. Follow the steps below to implement the call.

L step 1

Create a WebService method in. net to be called by Pb, As shown in-1.

Figure-1

L step 2

It is recommended to publish this WebService in IIS mode, as shown in-2.

Figure 2

Here, it is explained that after being published as IIS, it can be opened directly in the browser, but its suffix is asmx, and Pb requires the WSDL method, that is, how to generate the WSDL file? As shown in-3, save it as a file and store it.

Figure-3

Now, the preparation is complete.

L step 3

Create a PB solution file, as shown in-4.

Figure 4

A pbwsclient11.pbd file must be referenced. Otherwise, the call will fail. This file can be found in the installation path.

L step 4

Starting from this step, create an object step by step, as shown in the list.

-5. Select the Web Service proxy wizard icon.

-6. It does not matter if this option is not checked.

-7. Enter the path of the generated WSDL file (absolute path)

-As shown in figure 8, if you get here, there will be almost no problems.

-9. compile it here, that is, save the icon next to it, and write the rest.Code,-10 is the final result.

Figure-10

L step 5

Create a customobject object, declare a method, and call it directly, as shown in-11.

Figure-11

L step 6

You can call it just like calling the Pb method. 12 and 13

Figure-12

Figure 13

 

The source code is as follows:

/Files/xiyang1011/webserviceexample.rar

/Files/xiyang1011/pbexample.rar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.