locked
How to invoke a WebService from a custom Sharepoint Activity? RRS feed

  • Question

  • Hello everybody,

    I am using Visual Studio 2010 and Sharepoint 2010. I've created a fully trusted custom activity that I am now able to add to the workflow created from the Sharepoint Designer. My activity extends System.Workflow.ComponentModel.Activity and currently just writes something to a log file on disk.

    How can I access and invoke web service calls from my custom activity? What are the best practices involving that?

    Many thanks...

    Wednesday, February 15, 2012 2:39 PM

All replies

  • You can make a webservice call from custom activity. Can you be a bit more specifiq about what you really want to know about making webservice call from your code?
    Wednesday, February 15, 2012 4:11 PM
  • Hello Raihan and thank you for your quick response,

     In my case I want to invoke the methods exposed by a WSDL file that I can access at a specific url. For example www.mysite.com exposes the following wsdl file at the url: www.mysite.com/rest/users?wsdl

    <wsdl:definitions name="users" targetNamespace="http://webservice.user.modules.mysite/">
        <wsdl:import location="http://www.mysite.com/rest/users?wsdl=UserWebService.wsdl"
                     namespace="http://www.mysite.com/webService"></wsdl:import>
        <wsdl:binding name="usersXMLBinding" type="ns1:userWebService">
            <wsdl:operation name="getUserById">
                <wsdl:input name="getUserById"></wsdl:input>
                <wsdl:output name="getUserByIdResponse"></wsdl:output>
                <wsdl:fault name="WebServiceException"></wsdl:fault>
            </wsdl:operation>
            <wsdl:operation name="setPassword">
                <wsdl:input name="setPassword"></wsdl:input>
                <wsdl:output name="setPasswordResponse"></wsdl:output>
                <wsdl:fault name="WebServiceException"></wsdl:fault>
            </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="users">
            <wsdl:port binding="tns:usersXMLBinding" name="UserWebServiceImplPort">
                <soap:address location="http://www.mysite.com/rest/users"/>
            </wsdl:port>
        </wsdl:service>
    </wsdl:definitions>
    
    

    From my custom activity I would like to check if a user would a specific id exists (so I would like to call the "getUserById" method exposed by the web service.

    Can you help me with that?

    Many thanks...

    Thursday, February 16, 2012 10:50 AM
  • Can anyone help me with this?
    Tuesday, February 21, 2012 2:01 PM