1. Shaila Panwar
  2. PowerBuilder
  3. Tuesday, 19 March 2019 01:04 AM UTC

Hi ,

 

I am trying to call a web service from the Appeon PB.

I have followed all the instructions mentioned in the article for the web-service call to work.

When I try to make the call I get the exception "Cannot Invoke Web service" 

My web-service proxy is created using .Net engine.

I have imported the pbwsclient170.pbx as well in my library.

when I try to access the web-service it says cannot invoke web-service exception.

Can anyone help me to understand if I am missing anything here.

 

Thanks,

Shaila

Accepted Answer
Marco Meoni Accepted Answer Pending Moderation
  1. Wednesday, 20 March 2019 08:12 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi Shaila,

happy to know that you solved.

You can pass the production URL as 3rd argument in the CreateInstance function:

conn.CreateInstance(lnv_webservice, 'n_webservice', 'http://localhost/webservice/n_webservice.asmx')

Best,

.m

Comment
  1. Shaila Panwar
  2. Wednesday, 20 March 2019 23:47 PM UTC
Thank you so much .. This worked for me...
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 19 March 2019 06:49 AM UTC
  2. PowerBuilder
  3. # 1

We recommend using the HTTPClient or RESTClient to call Web services, even if you created the web service using the old Sybase .NET engine.

Is the Web service you are calling a REST or SOAP web service?  If it is created by the old Sybase .NET engine then it should be a SOAP web service.

If calling SOAP web service did you follow the instructions in this article: https://community.appeon.com/index.php/articles-blogs/tutorials-articles/2-powerbuilder/236-call-soap-web-services-using-httpclient-object

If calling REST web service did you study the various REST code samples in CodeXchange: https://community.appeon.com/index.php/codeexchange/powerbuilder/43-rest-demo-app-for-powerbuilder-2017-r2-and-r3-new-features#41 and https://community.appeon.com/index.php/codeexchange/powerbuilder/33-restful-demo#31

Comment
There are no comments made yet.
Marco Meoni Accepted Answer Pending Moderation
  1. Tuesday, 19 March 2019 07:19 AM UTC
  2. PowerBuilder
  3. # 2

Hello Shaila,

you are warmly encouraged to follow Armeen's suggestions, i.e. consume SOAP WS via the new HTTPClient object instead of legacy SOAP proxy.

However, if you still want to give a chance to PB proxy, please post your client code: SoapConnection declaration + proxy instantiation + WS method call.

Also, a screenshot of the functions available in your proxy (the "green icon" created in your WS project) would be beneficial in order to understand if you are calling an actual method. 

Your error msg seems a generic copy&paste from Sybase example, and - stated that SoapConnection::CreateInstance succeeds with return code 0 - it may be related to how you call the WS function.

Best,

.m

Comment
  1. Kevin Ridley
  2. Tuesday, 19 March 2019 12:31 PM UTC
In addition to what Marco said, be sure to wrap your call in a try/catch block. Catch SoapException, then you may get a better error also.



Try

.

.

.

Catch (SoapException se)

MessageBox("SoapException", se.getmessage())

End Try
  1. Helpful
There are no comments made yet.
Shaila Panwar Accepted Answer Pending Moderation
  1. Tuesday, 19 March 2019 23:42 PM UTC
  2. PowerBuilder
  3. # 3

Hi All,

 

Thanks for the response I followed the mentioned article and now the problem seems to be resolved.

The only thing I am having issue is while creating the proxy I have used the development URL.

So the objects are created based on that URL.

If I have to deploy my code to Test or Production environment how I can change the URL dynamically so the it goes hit the correct webservice.

For example my URL in development is:


http://localhost:24840/wsservice/services/WSService?wsdl

 

and in Production if the URL is something like  below:


http://localhost:19530/samwsservice/services/webservices/SamWSService?wsdl

 

Can I change the URL dynamically and I do not need to regenerate the objects for each environment?

 

Thanks,

Shaila Panwar

Comment
  1. Armeen Mazda @Appeon
  2. Wednesday, 20 March 2019 03:24 AM UTC
If you are using the new HTTPClient object mentioned in the article there is nothing to re-generate and you can dynamically change the URL by assigning it to a variable and passing that variable as the parameter in the applicable function of the HTTPClient object.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.