Skip to main content

Consuming WCF service with Metro

3 replies [Last post]
injurer
Offline
Joined: 2012-01-24
Points: 0

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
patluze
Offline
Joined: 2010-09-28
Points: 0

Yes. The "Accessing Metro Services Using WCF Clients" chapter in the Metro Users Guide should be a good starting point: http://metro.java.net/guide/ch15.html.

injurer
Offline
Joined: 2012-01-24
Points: 0

The guide there refers to example files that are not available for download (seems to be missing).

Also I tried consuming a WCF service myself using Metro, with wsHttpBinding, but I'm getting errors.

I'm using wsHttpBinding as I need authentication and encryption.

Here's what I get trying to run the client:

2012-1-25 9:02:08 [com.sun.xml.ws.policy.parser.PolicyConfigParser]  parse
INFO: WSP5018: Loaded WSIT configuration from file: file:/C:/Users/zzzzzz/Documents/NetBeansProjects/DAFConnectWSIT/build/classes/META-INF/wsit-client.xml.
2012-1-25 9:02:08 com.sun.xml.ws.security.impl.policy.Constants log_invalid_assertion
WARNING: SP0100: Policy assertion Assertion[com.sun.xml.ws.policy.sourcemodel.DefaultPolicyAssertionCreator$DefaultPolicyAssertion] {
    assertion data {
        namespace = 'http://schemas.microsoft.com/ws/2005/07/securitypolicy'
        prefix = 'mssp'
        local name = 'SslContextToken'
        value = 'null'
        optional = 'false'
        ignorable = 'false'
        attributes {
            name = 'http://schemas.xmlsoap.org/ws/2005/07/securitypolicy:IncludeToken', value = 'http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient'
        }
    }
    no parameters
    nested policy {
        namespace version = 'v1_5'
        id = 'null'
        name = 'null'
        vocabulary {
            1. entry = 'http://schemas.xmlsoap.org/ws/2005/07/securitypolicy:RequireDerivedKeys'
        }
        assertion set {
            Assertion[com.sun.xml.ws.policy.sourcemodel.DefaultPolicyAssertionCreator$DefaultPolicyAssertion] {
                assertion data {
                    namespace = 'http://schemas.xmlsoap.org/ws/2005/07/securitypolicy'
                    prefix = 'sp'
                    local name = 'RequireDerivedKeys'
                    value = 'null'
                    optional = 'false'
                    ignorable = 'false'
                    no attributes
                }
                no parameters
                no nested policy
            }
        }
    }
} is not supported under Token assertion.<br />Exception in thread &quot;main&quot; java.lang.NullPointerException<br /> at com.sun.xml.ws.security.impl.policyconv.SignedSupportingTokensProcessor.addToPrimarySignature(SignedSupportingTokensProcessor.java:90)<br /> at com.sun.xml.ws.security.impl.policyconv.SupportingTokensProcessor.process(SupportingTokensProcessor.java:151)<br /> at com.sun.xml.ws.security.impl.policyconv.BindingProcessor.processSupportingTokens(BindingProcessor.java:340)<br /> at com.sun.xml.ws.security.impl.policyconv.XWSSPolicyGenerator.processNonBindingAssertions(XWSSPolicyGenerator.java:276)<br /> at com.sun.xml.ws.security.impl.policyconv.XWSSPolicyGenerator.process(XWSSPolicyGenerator.java:204)<br /> at com.sun.xml.ws.security.impl.policyconv.XWSSPolicyGenerator.process(XWSSPolicyGenerator.java:160)<br /> at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.constructPolicyHolder(SecurityTubeBase.java:1360)<br /> at com.sun.xml.wss.jaxws.impl.SecurityClientTube.addOutgoingProtocolPolicy(SecurityClientTube.java:717)<br /> at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.buildProtocolPolicy(SecurityTubeBase.java:1305)<br /> at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.collectPolicies(SecurityTubeBase.java:774)<br /> at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.&lt;init&gt;(SecurityTubeBase.java:274)<br /> at com.sun.xml.wss.jaxws.impl.SecurityClientTube.&lt;init&gt;(SecurityClientTube.java:152)<br /> at com.sun.xml.wss.provider.wsit.SecurityTubeFactory.createTube(SecurityTubeFactory.java:285)<br /> at com.sun.xml.ws.assembler.TubeCreator.createTube(TubeCreator.java:84)<br /> at com.sun.xml.ws.assembler.TubelineAssemblerFactoryImpl$MetroTubelineAssembler.createClient(TubelineAssemblerFactoryImpl.java:130)<br /> at com.sun.xml.ws.client.Stub.createPipeline(Stub.java:228)<br /> at com.sun.xml.ws.client.Stub.&lt;init&gt;(Stub.java:205)<br /> at com.sun.xml.ws.client.Stub.&lt;init&gt;(Stub.java:178)<br /> at com.sun.xml.ws.client.sei.SEIStub.&lt;init&gt;(SEIStub.java:85)<br /> at com.sun.xml.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:608)<br /> at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:348)<br /> at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:330)<br /> at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:312)<br /> at javax.xml.ws.Service.getPort(Service.java:99)<br /> at daf.zzz.com.ExchangeService.getDatabaseIExchangeService(ExchangeService.java:94)<br /> at dafconnectwsit.DAFConnectWSIT.main(DAFConnectWSIT.java:25)<br />Java Result: 1
patluze
Offline
Joined: 2010-09-28
Points: 0

I don't use SslContextToken in my WCF service configuration, so I can't help with any specifics, but these links seem related to your problem:

http://webservices20.blogspot.com/2008/10/interoperability-gotcha-sslcon...

http://java.net/jira/browse/WSIT-588

I hope that helps.