cancel
Showing results for 
Search instead for 
Did you mean: 

WCF Client Proxy generate error

Former Member
0 Kudos

Hi, new to Powerbuilder .net using 12.5.2 build 5609.  Creating a WCF Client Proxy to connect to Web Service as I need to pass soap header security.  When I generate the proxy I keep getting the error "Object reference not set to an instance of an object".  I have tried generating another WCF Client Proxy using an amazon example and generates without any errors.  Searching the web for days on end hasn't helped me.  Hopeing someone can shed some light as where to look.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

I am obviously doing something wrong in PowerBuilder .Net in trying to generate the Proxy as I can use the wsdl file to access and send messages using SoapUI.  When I create the new WCF Client Proxy in my project I can see the services and the data classes.  The error occurs when I try to generate the proxy.  The soap messages I need to send are using the wsse security header which is why I have to use .Net and not our normal application of PowerBuilder 12 or 11.  None of the other solutions seem to have helped in trying to work out what the issue is in the project I have created.  The error message "object reference not set to an instance of an object" doesn't offer any insights so I am stuck as to what I should do. If anyone has any further suggestions please let me know, otherwise if anyone can suggest another way I can build this application not using .Net.  Thanks

Former Member
0 Kudos

Hi Brenton;

  Can you tell us ...

1) Is the WS you are trying to connect to J2EE or .Net based?

2) What version & build of PB.Net are you using?

3) Can you tell us more about the exact error(s) you are getting?

4) Have you tried accessing the WS via the free WCF Test utility first?

5) Does your WS return non-standard "C" data types?

6) Does your WS return complex nested structures?

Regards ... Chris

Former Member
0 Kudos

Thanks Bruce and Chris for your insights into what could be my issue.  I however am still unable to generate the web service proxy in .net and can't work out what the issue is using the wsdl utility.  The wsdl file I have is used by other developers successfully (none I assume with pb.net) and the utility did not report any error that I could identify as the cause of the error "object reference not set to an instance of an object".

Former Member
0 Kudos

Hi Anne;

  Did you try testing the Web Service access using something like:

1) WCF Test - WCF Test Client (WcfTestClient.exe)

- or -

2) WIZDL Test -  wizdl - Web Service GUI Test Tool - Home

Regards ... Chris

Former Member
0 Kudos

Hi Chris

Used wcftestclient.exe and added the service in with no errors.  It seems only PowerBuilder 12 .net has an issue with the service.  Any other ideas?

Thanks

Karyna

Former Member
0 Kudos

Hi Annie;

  Thank you for the feedback!

  For me, this rules out the WS as being the issue. Its clearly now on the PB.Net side of the equation.

  The next step in my mind would be to use something like Fiddler2 (its free) to trace the interaction between the WS and WCFTest - then the interaction between PB.Net and WS. I suspect what you will find though is that there is something missing in the PB.Net to WS responses that causes it to fail. However, you should see the proper responses in the WCFTest trace interaction.

If you cannot resolve the missing/errored exchanges from PB.Net to the WS from the Fiddler2 tracing information at least you will have a documented reason why the WCF interaction fails. This information should be enough to open a support ticket with SAP technical support - attaching the Fidder2 trace as a good example of what is the exact issue.

Hopefully, someone else can jump in here and add some more suggestions / alternatives that you can try. Good luck!

Regards ... Chris

Former Member
0 Kudos

As per I know PB.Net failed to generate the proxy class when there is WS security with token based Authentication ( On Server Side ).  This may be because of Web Service doesn't explicitly expose WS security tags on the request.

Thanks Balu

Former Member
0 Kudos

I would recommend to create Proxy class Microsoft .Net and build as .Net Assembly and using the Power Builder. Since the PowerBuilder WCF doesn't support the security header on the SOAP call.

Even in PowerBuilder 12.6 is the same case.  I tried the same and failed to create WCF proxy to pass the security header in PowerBuilder.Net ...

former_member190719
Active Contributor
0 Kudos

>>I would recommend to create Proxy class Microsoft .Net and build as .Net Assembly and

>>using the Power Builder. Since the PowerBuilder WCF doesn't support the security header

>>on the SOAP call.


PowerBuilder's WCF proxy does handle security headers.  That's one of the main reasons they introduced. it.



Former Member
0 Kudos

I have personally tried the same with PowerBuilder 12.6.Net using WCF and failed. Still there is is an limitation on passing security header on SOAP.  Even i tried with interrupting the request and tried to add the Security header.

Do you have any sample code for the same? it helps

Thanks,

Balu

former_member190719
Active Contributor
0 Kudos

Creation and Consumption of Web Services with PowerBuilder

http://pbdj.sys-con.com/node/2133766

Former Member
0 Kudos

Hi Bruce,

I have tried this WCF in PB only support to add the AddWSEUserNameToken in the Wsse:Security header.

But if you have BinarySecurityToken  or similar other token which you want to pass in the Wsse:Security , then there is no option.

If you have any method/ logic to pass the BinarySecurityToken , then please advise

Thanks

Balu

former_member190719
Active Contributor
0 Kudos

WCF in PB has support of a number of different authentication method, including ClientCertificate which should send a BinarySecurityToken.  I posted a sample of such in this earlier thread:

former_member190719
Active Contributor
0 Kudos

Try running the WSDL utility in the .Net SDK directly on the WSDL file.  It generally gives more meaningful error messages.

Former Member
0 Kudos

Hi, I have run the wsdl file with the wsdl.exe and get results saved to a text document without any errors I can identify.  Is there something specific I should be looking for in the output file?

Former Member
0 Kudos

Hi Anne;

  The other things that might upset PB are:

1) PB works only with 2D ANSI result sets. So if your WS returns a complex set of nested structures - PB will not be able to handle this and will error.

2) PB expects only standard C++ data types. If you have unique data types embedded, the WSDL will be rejected.

Regards ... Chris

Former Member
0 Kudos

Hi Chris

The WS returns structures but not sure if they are complex.  Each call sends a structure and returns a response structure.  What classifies the structure as complex?  Also, if I can generate the message using SoapUI and the wsdl.exe utility returns no errors, assuming PB12.net won't work, what do you suggest I use to connect to the WS?  We program our other applications using PowerBuilder 11 with a Sybase database.

Thanks again

Former Member
0 Kudos

As long as its a simple structure nest that resembles an ANSI 2D result set (aka rows & columns). The other consideration would be each structure field's data type. They must be one of the ones listed in the PB Help supported "Data Types".

Former Member
0 Kudos

Hi Chris

I believe they are all simple data types supported by PB.  Where do I go from here as I still can't generate the Web Service Proxy in PB.net?  Can I send you the wsdl to check?

Former Member
0 Kudos

I would recommend trying a WSDLtest utility ...

I.E.  WebServiceStudio - Home