webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Can WebMethods call Web Service in C#

  • 1.  Can WebMethods call Web Service in C#

    Posted Tue October 11, 2005 09:22 AM

    I built a Web Service in C#, C# client can call it rightly, but get a error when I call it in webMethods. the error msg is “Server was unable to process request. –> Object reference not set to an instance of an object.” what’s the matter? please help me.


    #soa
    #API-Management
    #webMethods


  • 2.  RE: Can WebMethods call Web Service in C#

    Posted Tue October 11, 2005 07:55 PM

    Toby,

    I assume that you generated a WSDL to describe your C# service and used the Web Service Connector wizard to generate a Flow service to invoke it.

    Does your C# service use soap/rpc or document/literal style? Can you capture the soap request and soap reply messages and post them here with the WSDL?

    Mark


    #API-Management
    #webMethods
    #soa


  • 3.  RE: Can WebMethods call Web Service in C#

    Posted Thu October 13, 2005 03:51 AM

    Mark,

    Thank you for your help. It’s OK now, but I get other problem.When I pull the following WSDL into Developer to create the web service connectors, the document that represents PartyInfo is nowhere to be found. Do we must manually add them as document types in webMethods? and how can I get document types according the WSDL?


    WSDL.xml (5.6 k)


    #soa
    #webMethods
    #API-Management


  • 4.  RE: Can WebMethods call Web Service in C#

    Posted Thu October 13, 2005 06:18 AM

    The WSDL indicates that the soap request must include a PartyInfo element in the soap header. The webMethods IS Web Services Connector will not generate Flow that processes soap message headers.

    However, built-in services are supplied that will allow you to work with soap headers. Create a document type from the PartyInfo element definition, populate it, convert it to a node and then use pub.soap.utils:addHeaderEntry to add it to the header of a soap message you created using pub.soap.utils:createSoapData.

    I used XML Spy to create this sample soap request from your WSDL:

    Sample Soap Request
    SampleSoapRequest.xml (0.8 k)

    		HTH, 
    

    Mark


    #webMethods
    #soa
    #API-Management


  • 5.  RE: Can WebMethods call Web Service in C#

    Posted Fri October 14, 2005 04:48 AM

    Mark,
    It is working now. Thank you very much.

    Toby


    #soa
    #webMethods
    #API-Management


  • 6.  RE: Can WebMethods call Web Service in C#

    Posted Thu April 06, 2006 05:20 PM

    Hello,

    I believe that I am having this exact issue, but since the upgrade, I don’t know where to look for the above referenced file to see if they can help me.

    I have a webService that was created in asp.net and returns the error “Object reference not set to an instance of an object” when I run it through the webService connector generated from the WSDL.


    #API-Management
    #webMethods
    #soa


  • 7.  RE: Can WebMethods call Web Service in C#

    Posted Thu April 06, 2006 06:23 PM

    You have a C# web service that requires you to provide soap header elements?

    If so, the IS Web Service Connector wizard will usually generate an “almost working” Flow service. However, it will attempt to populate the document type for the header and then add it to the soap body rather than the soap header. You can change one line of Flow to correct this in most cases.

    What happens when you attempt to generate Flow using the Web Services Connector?

    Mark


    #API-Management
    #webMethods
    #soa


  • 8.  RE: Can WebMethods call Web Service in C#

    Posted Thu April 06, 2006 07:21 PM

    First thing I am on 6.01 SP 4… :frowning:

    When I generate the WSC I get a couple of warnings:

    [ISS.0092.9015] Warning: Port does not have a valid binding type, port was not generated.

    When I sent this off to webMethods, the created the WSC in their 6.1 environment and did not receive any errors so I ask them to send be the generated services. I compared my generation to theirs and have not found any material differences.

    Other than the warning, the generation goes fine.


    #API-Management
    #webMethods
    #soa


  • 9.  RE: Can WebMethods call Web Service in C#

    Posted Thu April 06, 2006 09:41 PM

    Remember, you don’t need to have Developer generate a Flow for you to invoke a web service.

    You can look at a generated Flow and follow the basic steps to do this yourself.

    You need to start with document types that correspond to the input and output messages. Populate the input document, convert it to a string then a node and add it to the soap body. Do the same thing if you have any header elements.

    Once your soap message is populated you can sent it with pub.client:soapHTTP. You will get a soapResponseData object as an output of this service unless there is an exception (like can’t find host). The soapResponseData will contain either the result document inside the soap body or will contain a soap fault.

    There’s nothing magic about the Flow generated by the web services connector. In fact, because if uses hardcoded URLs and does not have any capability to retry the soapHTTP call on transient errors, I don’t recommend using the generated code except in early development.

    HTH,

    Mark


    #soa
    #webMethods
    #API-Management