views:

127

answers:

1

This is my first try trying to use WCF, so I'm guessing I'm doing something incorrect. I'm trying to access a soap service defined by the WSDL at http://confluence.atlassian.com/rpc/soap-axis/confluenceservice-v1?wsdl I'm using VS2010, and I add a Service Reference to my project and point it to the URL there (or rather, our intranet install of it), but when I use the Object Browser to view the service, the operations on the interface are ALL void methods with no parameters. It seems that WCF is not reading the type information correctly. It doesn't give errors, but it's giving tons of warnings like the following:

Warning 1 Custom tool warning: Fault named InvalidSessionException in operation getPermissions cannot be imported. Unsupported WSDL, the fault message part must reference an element. This fault message does not reference an element. If you have edit access to the WSDL document, you can fix the problem by referencing a schema element using the 'element' attribute. Z:\TestLibrary\Service References\Confluence\Reference.svcmap 1 1 TestLibrary

Warning 2 Custom tool warning: The optional WSDL extension element 'body' from namespace 'http://schemas.xmlsoap.org/wsdl/soap/' was not handled. XPath: //wsdl:definitions[@targetNamespace='http://confluence.atlassian.com/rpc/soap-axis/confluenceservice-v1']/wsdl:binding[@name='confluenceservice-v1SoapBinding']/wsdl:operation[@name='getPermissions']/wsdl:input[@name='getPermissionsRequest'] Z:\TestLibrary\Service References\Confluence\Reference.svcmap 1 1 TestLibrary

What am I doing wrong? I tried changing the config of the service with a combinations of options, but I could never pull in the types from the WSDL correctly. I've been assuming that WCF will auto-generate the type classes along with the service interface. Am I supposed to figure out what types are in use in the WSDL and create the classes and data contracts myself, or is it something else?

+1  A: 

Hhmm... interesting - I ran svcutil.exe from the command line against that URL you provided, and while I get a ton of warnings about WSDL issues, I do also get some code - something like:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.4952
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://confluence.atlassian.com/rpc/soap-axis/confluenceservice-v1", ConfigurationName="ConfluenceSoapService")]
public interface ConfluenceSoapService
{
    // CODEGEN: Generating message contract since the wrapper namespace (http://soap.rpc.confluence.atlassian.com) of message getPermissionsRequest does not match the default value (http://confluence.atlassian.com/rpc/soap-axis/confluenceservice-v1)
    [System.ServiceModel.OperationContractAttribute(Action="", ReplyAction="*")]
    [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, Use=System.ServiceModel.OperationFormatUse.Encoded)]
    getPermissionsResponse getPermissions(getPermissionsRequest request);

    // CODEGEN: Generating message contract since the wrapper namespace (http://soap.rpc.confluence.atlassian.com) of message searchRequest does not match the default value (http://confluence.atlassian.com/rpc/soap-axis/confluenceservice-v1)
    [System.ServiceModel.OperationContractAttribute(Action="", ReplyAction="*")]
    [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, Use=System.ServiceModel.OperationFormatUse.Encoded)]
    [System.ServiceModel.ServiceKnownTypeAttribute(typeof(RemoteException))]
    [System.ServiceModel.ServiceKnownTypeAttribute(typeof(Vector))]
    [System.ServiceModel.ServiceKnownTypeAttribute(typeof(RemotePermission))]
    [System.ServiceModel.ServiceKnownTypeAttribute(typeof(RemoteNodeStatus))]
    [System.ServiceModel.ServiceKnownTypeAttribute(typeof(RemotePageHistory))]
    [System.ServiceModel.ServiceKnownTypeAttribute(typeof(RemoteContentPermission))]
    [System.ServiceModel.ServiceKnownTypeAttribute(typeof(AbstractRemotePageSummary))]
    [System.ServiceModel.ServiceKnownTypeAttribute(typeof(RemoteSpaceSummary))]
    [System.ServiceModel.ServiceKnownTypeAttribute(typeof(RemoteSearchResult))]
    searchResponse search(searchRequest request);

So I would try to use svcutil.exe from the command line to generate your ConfluenceSoapService.cs file and then use that to talk to your Confluence service.

marc_s
+1 for suggesting svcutil.exe.
Bernard
Hmm...it appears to be working with svcutil.exe. That's really odd. Thanks though.
Squeeself