[JBossWS] - Re: Writing a client - no examples for BindingProvider based
by mjhammel
"alessio.soldano(a)jboss.com" wrote : This is not your situation, you're not using the persistence context in a servlet, you need injection in a SLSB. And my previous post shows that it works.
That may be, but then there is this discussion:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=107353
In any case, I've done everything I think I need to do and it still doesn't work. I'd be happy for someone to show me what I've done wrong, but barring that I'd still have to say, in my case, it doesn't work.
anonymous wrote : I've just tried this too. It works more or less. I'm saying so since of course the problems you might have to face are lazy instantiation and cyclic referenced structure (that cannot be serialized into xml without references).
|
The "lazy" exception was due to Hibernate creating OneToMany annotations for fields in one table that were referenced by other tables. These references could not be serialized and caused the exceptions.
The references were created by Hibernate during the reverse engineering process because I had specified a foreign-key in other tables that pointed back to the first table. I removed the foreign-keys from my MySQL DB schema and the problem went away. The only drawback I can find on my end is that I need to add code to verify I don't have abandoned rows with links to rows that don't actually exist in other tables. Being a C programmer originally, I'm used to writing all my own checks like this, so it's not that big a deal. At least now I can pass back the serialized objects that represent db rows.
FWIW, I'm now passed this issue and trying to get access to the DB from a Schedulable. Like my Web Services class, injection does not seem to work there either. Unlike my Web Services class, I can't seem to find a work around in the schedulable because I don't know how to create a transaction and the method for retrieving the UserTransaction I used in the WS class doesn't work in a schedulable. See
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=127493
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119683#4119683
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119683
18 years, 2 months
[JBossWS] - WSSE UsernameToken without HTTP basic auth?
by mikaeljl
Hi!
I've managed to implement a web service + a client that authenticates with WSSE UsernameToken.
My problem is that the client side is always including the HTTP Authorization header.
Something like:
Authorization: Basic a2VybWl0OnRoZWZyb2c=
Note, the WSSE data in the SOAP header is also included and looking ok.
How can I keep the client from including the http basic authentication data and only include wsse data? Is this possible? What am I missing?
My client is configured with
<config>
| <username/>
| </config>
I do the following in the client code:
URL securityURL = new File("resources/jboss-wsse-client.xml").toURI().toURL();
| ((StubExt)myServiceStub).setSecurityConfig(securityURL.toExternalForm());
| ((StubExt)myServiceStub).setConfigName("Standard WSSecurity Client");
| Map<String, Object> reqContext = bp.getRequestContext();
| reqContext.put(BindingProvider.USERNAME_PROPERTY, "kermit");
| reqContext.put(BindingProvider.PASSWORD_PROPERTY, "thefrog");
I guess that the client libraries will pick up the properties set on the request ctx and therefore assume that basic auth should be applied?
Is there a way supply the username/pwd info to the WSSecurityDispatcher without having the client libraries adding http auth?
I do get everything to work if I add the following to web.xml on the server side
<login-config>
| <auth-method>BASIC</auth-method>
| <realm-name>JBossWS</realm-name>
| </login-config>
but I would really like to only use wsse and not http basic authentication.
The following in org/jboss/ws/core/client/RemotingConnectionImpl.java may be what is causing the problem together with implementation of the createRemotingMetaData method:
static
| {
| metadataMap.put(Stub.USERNAME_PROPERTY, "http.basic.username");
| metadataMap.put(Stub.PASSWORD_PROPERTY, "http.basic.password");
| metadataMap.put(BindingProvider.USERNAME_PROPERTY, "http.basic.username");
| metadataMap.put(BindingProvider.PASSWORD_PROPERTY, "http.basic.password");
| }
I'm currently using jbossws 2.0.1.GA
/Mikael
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119564#4119564
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119564
18 years, 2 months
[JBossWS] - Re: WS-Attachment on jbossws
by paoletto
googled further, and found this on axis2 documentation:
| /* Sample client which sends a message with SwA type attachments */
|
| public void uploadFileUsingSwA(String fileName) throws Exception {
|
| Options options = new Options();
| options.setTo(targetEPR);
| options.setProperty(Constants.Configuration.ENABLE_SWA, Constants.VALUE_TRUE);
| options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
| options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
| options.setTo(targetEPR);
|
| ServiceClient sender = new ServiceClient(null,null);
| sender.setOptions(options);
| OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);
|
| MessageContext mc = new MessageContext();
| mc.setEnvelope(createEnvelope());
| FileDataSource fileDataSource = new FileDataSource("test-resources/mtom/test.jpg");
| DataHandler dataHandler = new DataHandler(fileDataSource);
| mc.addAttachment("FirstAttachment",dataHandler);
|
| mepClient.addMessageContext(mc);
| mepClient.execute(true);
| }
|
isnt it possible to do the same with jbossws?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119553#4119553
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119553
18 years, 2 months
[JBossWS] - Re: Cannot access web service with HTTP Basic Authentication
by jeff norton
That FAQ does indeed cover my case and the solution works for me. I'm now a happy camper. Microsoft should feel intense embarrassment about the state of their HTTP implementation.
Might be good if someone updated http://jbws.dyndns.org/mediawiki/index.php?title=Authentication to point out the need to secure only POST and leave GET open to access the WSDL as well as put in a link to the problems with .NET clients. I tried to edit it but was not able.
As for wsconsume when I run it I do point it to a local wsdl file. I was always mystified as to why it needed the wsdl url at runtime since the client should have been generated with everything it needed (that's the way my .NET client works -- no WSDL needed at runtime). There seem to be two static methods (constructors) on Service. When I use the form that doesn't use the WSDL URL I get:
[exec] WARN - Cannot get port meta data for: {http://processlibrary.resonant.com/}RawDocumentRepositoryPort
| [exec] javax.xml.ws.WebServiceException: org.jboss.ws.WSException: Target endpoint address not setHow do you create an endpoint without the WSDL at runtime?
Anyway thanks for all the help. I'm now up and running!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119463#4119463
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119463
18 years, 2 months
[JBossWS] - Re: How can I change mustUnderstand attribute of wsse:securi
by mariovvl
Thanks for the info! I tried your suggestion but run into another problem:
After I added in my own post handler, the outgoing soap message did not contain the wsse:Security element anymore! I basically got an empty header
| <env:Header/>
|
| my debug log shows:
|
| INFO [STDOUT] org.jboss.ws.soap.SOAPHeaderImpl@1093b10[[env:Header: null]]
| INFO [STDOUT] org.jboss.ws.soap.SOAPBodyImpl@104a340[[env:Body: null]]
| INFO [STDOUT] org.jboss.ws.soap.SOAPHeaderElementImpl@c22b28[[wsse:Security: null]]
|
| .
In my post handler I did not do anything except print out the header child elements as shown below, so I don't understand how the security element got removed. Here's my code and configuration (I'm using jboss4.0.4.GA and jbossws1.0.3.GA):
I added my post-handler to the standard-jbossws-client-config.xml as followed:
<?xml version="1.0" encoding="UTF-8"?>
|
| <!-- $Id: standard-jbossws-client-config.xml 283 2006-05-05 23:08:11Z jason.greene(a)jboss.com $ -->
|
| <jbossws-config xmlns="urn:jboss:jbossws-config:5.0"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
| xsi:schemaLocation="urn:jboss:jbossws-config:5.0 http://www.jboss.com/xml/jbossws-config_1_0.xsd">
| ...
| <client-config>
| <config-name>Standard Secure Client</config-name>
| <post-handler-chain>
| <handler-chain-name>PostHandlerChain</handler-chain-name>
| <handler> <j2ee:handler-name>WSSecurityHandlerOutbound</j2ee:handler-name>
| <j2ee:handler-class>org.jboss.ws.wsse.WSSecurityHandlerOutbound</j2ee:handler-class>
|
| </handler>
| <handler>
| <j2ee:handler-name>MyOutboundHandler</j2ee:handler-name>
| <j2ee:handler-class>org.test.soap.handler.MyOutboundHandler</j2ee:handler-class>
| </handler>
| </post-handler-chain>
| </client-config>
| ...
|
| </jbossws-config>
My handler looks like this:
| public class MyOutboundHandler extends GenericHandler {
| ...
| public MyOutboundHandler () {};
|
| public boolean handleRequest(MessageContext msgContext) {
| SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
| SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
|
| SOAPHeader soapHeader = soapEnvelope.getHeader();
| Iterator it4 = soapHeader.getAllAttributes();
| while (it4.hasNext()) {
| System.out.println(it4.next());
| };
|
| Iterator it = soapHeader.getChildElements();
| while (it.hasNext()) {
| System.out.println(it.next());
| };
| }
| ...
| }
|
|
Any idea what I'm doing wrong?
Thanks,
Mario
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119358#4119358
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119358
18 years, 3 months