I'm using metro 2.0.1 for a client application who connects to WCF Service With security. Everything works fine in my unit tests but when I call the method in my Java application I get the following exception:
Exception in thread "main" java.lang.AssertionError: StreamMessage has been already consumed. See the nested exception for where it's consumed
at com.sun.xml.ws.security.opt.impl.incoming.VerifiedStreamMessage.unconsumed(VerifiedStreamMessage.java:512)
at com.sun.xml.ws.security.opt.impl.incoming.VerifiedStreamMessage.readPayloadAsJAXB(VerifiedStreamMessage.java:251)
at com.sun.xml.ws.fault.SOAPFaultBuilder.create(SOAPFaultBuilder.java:536)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:118)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:140)
at $Proxy42.getGiftvoucherBalance(Unknown Source)
at com.rs.sw.fs.service.jaxws.account.card.JaxWsGiftVoucherService.getBalance(JaxWsGiftVoucherService.java:245)
at com.rs.sw.fs.application.SkyllaApplication.main(SkyllaApplication.java:119)
Caused by: java.lang.Exception
at com.sun.xml.ws.security.opt.impl.incoming.VerifiedStreamMessage.unconsumed(VerifiedStreamMessage.java:516)
at com.sun.xml.ws.security.opt.impl.incoming.VerifiedStreamMessage.writePayloadTo(VerifiedStreamMessage.java:375)
at com.sun.xml.ws.security.opt.impl.incoming.VerifiedStreamMessage.writeTo(VerifiedStreamMessage.java:493)
at com.sun.xml.ws.message.AbstractMessageImpl.readAsSOAPMessage(AbstractMessageImpl.java:193)
at com.sun.xml.ws.security.opt.impl.incoming.VerifiedStreamMessage.readAsSOAPMessage(VerifiedStreamMessage.java:474)
at com.sun.xml.wss.jaxws.impl.PolicyResolverImpl.resolvePolicy(PolicyResolverImpl.java:151)
at com.sun.xml.ws.security.opt.impl.incoming.SecurityRecipient.createMessage(SecurityRecipient.java:894)
at com.sun.xml.ws.security.opt.impl.incoming.SecurityRecipient.validateMessage(SecurityRecipient.java:232)
at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.verifyInboundMessage(SecurityTubeBase.java:486)
at com.sun.xml.wss.jaxws.impl.SecurityClientTube.processClientResponsePacket(SecurityClientTube.java:405)
at com.sun.xml.wss.jaxws.impl.SecurityClientTube.processResponse(SecurityClientTube.java:338)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:639)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
at com.sun.xml.ws.client.Stub.process(Stub.java:319)
at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:157)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:109)
... 5 more
I guess there's a difference between my classpath in junit and my Java application (running eclipse and maven)
In case someone is interested here's our huge dependency tree:
[INFO] [dependency:tree]
[INFO] eres.fs:fs-std:jar:3.0.0.0-SNAPSHOT
[INFO] +- eres.fs:fs-core:jar:3.5.0-SNAPSHOT:compile
[INFO] | +- org.beanshell:bsh-core:jar:1.2b7:compile
[INFO] | +- commons-beanutils:commons-beanutils:jar:1.7.0:compile
[INFO] | +- commons-collections:commons-collections:jar:3.1:compile
[INFO] | +- commons-dbcp:commons-dbcp:jar:1.2.1:compile
[INFO] | +- commons-lang:commons-lang:jar:2.4:compile
[INFO] | +- commons-logging:commons-logging:jar:1.0.4:compile
[INFO] | +- commons-pool:commons-pool:jar:1.2:compile
[INFO] | +- net.sf.ehcache:ehcache-core:jar:1.7.2:compile
[INFO] | | \- org.slf4j:slf4j-api:jar:1.5.8:compile
[INFO] | +- jgoodies:forms:jar:1.0.5:compile
[INFO] | +- jdom:jdom:jar:1.0:compile
[INFO] | +- javax.transaction:jta:jar:1.0.1B:compile
[INFO] | +- postgresql:postgresql:jar:8.1-407.jdbc3:compile
[INFO] | +- org.springframework:spring-aop:jar:2.0.8:compile
[INFO] | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | +- org.springframework:spring-beans:jar:2.0.8:compile
[INFO] | +- org.springframework:spring-context:jar:2.0.8:compile
[INFO] | +- org.springframework:spring-core:jar:2.0.8:compile
[INFO] | +- org.springframework:spring-dao:jar:2.0.8:compile
[INFO] | +- org.springframework:spring-jdbc:jar:2.0.8:compile
[INFO] | +- org.springframework:spring-remoting:jar:2.0.8:compile
[INFO] | +- org.springframework:spring-web:jar:2.0.8:compile
[INFO] | +- wsdl4j:wsdl4j:jar:1.6.1:compile
[INFO] | +- xerces:xercesImpl:jar:2.7.1:compile
[INFO] | +- com.thoughtworks.xstream:xstream:jar:1.2.2:compile
[INFO] | | \- xpp3:xpp3_min:jar:1.1.3.4.O:compile
[INFO] | +- org.mortbay.jetty:jetty:jar:6.1.11:compile
[INFO] | +- org.mortbay.jetty:jetty-util:jar:6.1.11:compile
[INFO] | +- org.mortbay.jetty:servlet-api-2.5:jar:6.1.11:compile
[INFO] | +- xmlbeans:xbean:jar:2.2.0:compile
[INFO] | +- org.apache.xbean:xbean-spring:jar:2.8:compile
[INFO] | +- org.codehaus.xfire:xfire-aegis:jar:1.2.5:compile
[INFO] | | \- net.java.dev.stax-utils:stax-utils:jar:20040917:compile
[INFO] | +- org.codehaus.xfire:xfire-java5:jar:1.2.5:compile
[INFO] | +- org.codehaus.xfire:xfire-spring:jar:1.2.5:compile
[INFO] | | \- junit:junit:jar:3.8.1:test
[INFO] | +- org.codehaus.xfire:xfire-core:jar:1.2.5:compile
[INFO] | | +- javax.mail:mail:jar:1.4:compile
[INFO] | | +- jaxen:jaxen:jar:1.1-beta-9:compile
[INFO] | | | \- xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO] | | +- stax:stax-api:jar:1.0.1:compile (version managed from 1.0)
[INFO] | | +- commons-codec:commons-codec:jar:1.2:compile (version managed from 1.3)
[INFO] | | +- org.codehaus.woodstox:wstx-asl:jar:3.2.0:compile
[INFO] | | \- commons-httpclient:commons-httpclient:jar:3.0:compile
[INFO] | +- org.codehaus.xfire:xfire-xmlbeans:jar:1.2.5:compile
[INFO] | +- org.apache.ws.commons:XmlSchema:jar:1.1:compile
[INFO] | +- javax.activation:activation:jar:1.1:compile
[INFO] | +- eres.commons:barcode:jar:3.2.1:compile
[INFO] | | \- com.lowagie:itext:jar:1.3.1:compile
[INFO] | +- eres.commons:djester:jar:3.0.1:compile
[INFO] | +- eres.commons:I18N:jar:3.0.0:compile
[INFO] | +- eres.commons:log:jar:3.2.0:compile
[INFO] | +- eres.commons:util:jar:3.3.0-SNAPSHOT:compile
[INFO] | | \- jclark:xt:jar:20020507:compile
[INFO] | | \- jclark:xp:jar:19990102:compile
[INFO] | +- eres.commons:reporting:jar:3.1.0-SNAPSHOT:compile
[INFO] | | \- jasperreports:jasperreports:jar:3.1.2:compile
[INFO] | | +- commons-digester:commons-digester:jar:1.7:compile
[INFO] | | +- jfree:jcommon:jar:1.0.12:compile
[INFO] | | +- jfree:jfreechart:jar:1.0.9:compile
[INFO] | | \- xml-apis:xml-apis:jar:1.3.02:compile
[INFO] | +- eres.commons:set-expressions:jar:1.0.0:compile
[INFO] | +- eres.fs:fs-ebo-dao:jar:3.2.2:compile
[INFO] | +- eres.fs:skylla-theme:jar:3.2.0:compile
[INFO] | +- eres.fs:fashion-theme:jar:3.2.0:compile
[INFO] | +- eres.javapos:jpos-core:jar:3.3.0-SNAPSHOT:compile
[INFO] | | +- com.linuxnet:jpcsc:jar:0.7.2:compile
[INFO] | | +- gnu.io:RXTXcomm:jar:2.1.7:compile
[INFO] | | +- com.serialio:Serialio:jar:6.1:compile
[INFO] | | +- com.javapos:jpos:jar:1.13.0:compile
[INFO] | | | \- xalan:xalan:jar:2.6.0:test (scope managed from compile)
[INFO] | | +- com.javapos:jcl_editor:jar:2.2.0:runtime
[INFO] | | +- com.javapos:POSTest:jar:1.7.0:runtime
[INFO] | | +- com.sun.comm:comm:jar:2.0.0:compile
[INFO] | | +- com.serialio:JavaTerm:jar:5.4:runtime
[INFO] | | +- com.retail-logic:SolveLink:jar:1.3.0.0:compile
[INFO] | | \- jp.co.nec.jpos:tw5500jpos:jar:1.0.3:compile
[INFO] | +- eres.messagebus:ebo-javaobject:jar:3.2.2:compile
[INFO] | | +- eres.messagebus:ebo-javaobjectAPIs:jar:3.2.2:compile
[INFO] | | +- org.jibx:jibx-run:jar:1.1.6.2:compile
[INFO] | | +- aspectj:aspectjrt:jar:1.5.3:compile
[INFO] | | \- joda-time:joda-time:jar:1.2.1:compile
[INFO] | +- eres.messagebus:gateway:jar:4.0.2.0.2:compile
[INFO] | | +- sonic:sonic_Crypto:jar:6.1:runtime
[INFO] | | +- sonic:sonic_Selector:jar:6.1:runtime
[INFO] | | +- sonic:sonic_Client:jar:6.1:compile
[INFO] | | +- sonic:sonic_SF:jar:6.1:runtime
[INFO] | | +- commons-io:commons-io:jar:1.4:compile
[INFO] | | \- gnu:gnu-regexp:jar:1.0.6:compile
[INFO] | +- eres.messagebus:jebo-listener:jar:3.2.2:compile
[INFO] | | +- eres.messagebus:ebo-marshaller:jar:3.2.2:compile
[INFO] | | \- eres.messagebus:ebo-jibx-marshaller:jar:3.2.2:compile
[INFO] | +- eres.services:services-client:jar:3.2.0:compile
[INFO] | +- eres.services:waitticket-service:jar:3.2.1-SNAPSHOT:compile
[INFO] | +- net.sourceforge.jtds:jtds:jar:1.2:compile
[INFO] | +- eres.fs:remote-control:jar:3.0.0-SNAPSHOT:compile
[INFO] | | \- com.sun.xml.ws:webservices-rt:jar:2.0.1:compile
[INFO] | | \- javax.xml:webservices-api:jar:2.0.1:compile
[INFO] | +- eres.services:customer-service-client:jar:3.3.0-SNAPSHOT:compile
[INFO] | | \- eres.services:service-client-commons:jar:3.3.0-SNAPSHOT:compile
[INFO] | +- eres.services:loyalty-service-client:jar:3.2.0:compile
[INFO] | +- eres.services:notification-service-client:jar:3.3.0-SNAPSHOT:compile
[INFO] | +- eres.fs.promopack:promopackAPIs:jar:3.2.0:compile
[INFO] | +- com.rs.sw.commons:commons-util:jar:3.0.0-SNAPSHOT:compile
[INFO] | +- com.rs.sw.fs.framework.domain:fs-domain-core:jar:3.0.0-SNAPSHOT:compile
[INFO] | +- com.rs.sw.fs.framework.domain:fs-domain-article:jar:3.0.0-SNAPSHOT:compile
[INFO] | +- com.rs.sw.fs.framework.domain:fs-domain-account:jar:3.0.0-SNAPSHOT:compile
[INFO] | +- com.rs.sw.fs.framework.repository:fs-repository-core:jar:3.0.0-SNAPSHOT:compile
[INFO] | | +- com.rs.sw.fs.framework.data:fs-data-api:jar:3.0.0-SNAPSHOT:compile
[INFO] | | \- org.slf4j:slf4j-log4j12:jar:1.5.8:compile
[INFO] | +- com.rs.sw.fs.framework.repository:fs-repository-skylla:jar:3.0.0-SNAPSHOT:compile
[INFO] | | +- com.rs.sw.fs.framework.data:fs-data-jdbc:jar:3.0.0-SNAPSHOT:compile
[INFO] | | +- com.rs.sw.fs.framework.data:fs-data-service:jar:3.0.0-SNAPSHOT:compile
[INFO] | | +- com.rs.sw.fs.framework.domain:fs-domain-service:jar:3.0.0-SNAPSHOT:compile
[INFO] | | +- com.rs.sw.fs.framework.service:fs-service-api:jar:3.0.0-SNAPSHOT:compile
[INFO] | | \- com.rs.sw.fs.framework:fs-test:jar:3.0.0-SNAPSHOT:compile
[INFO] | | +- dbunit:dbunit:jar:2.1:test (scope managed from compile)
[INFO] | | \- com.rs.sw.commons:commons-test:jar:3.0.0-SNAPSHOT:test (scope managed from compile)
[INFO] | +- com.rs.sw.fs.framework:fs-view:jar:3.0.0-SNAPSHOT:compile
[INFO] | +- com.rs.sw.fs.framework.data:fs-data-gateway:jar:3.0.0-SNAPSHOT:compile
[INFO] | \- com.rs.sw.fs.framework.service:fs-service-jaxws:jar:3.0.0-SNAPSHOT:compile
[INFO] | +- com.rs.sw.fs.framework.service:fs-service-jaxws-giftvoucher:jar:3.0.0-SNAPSHOT:compile
[INFO] | \- com.rs.sw.commons:commons-jaxws:jar:3.0.0-SNAPSHOT:compile
[INFO] \- eres.commons:launcher:jar:1.0.1:compile
[INFO] +- log4j:log4j:jar:1.2.13:compile
[INFO] \- eres.commons:system-util-native:dll:1.0.0:compile
[INFO] \- eres.commons:system-util:jar:1.0.0:compile