Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Web-servise(avtoritsiya client to the server)
Web-servise [message #891851] Tue, 26 June 2012 05:41
denis denis13bog is currently offline denis denis13bog
Messages: 1
Registered: June 2012
Junior Member
Good afternoon, colleagues,

huge hello to you from Russia))))

I have a poser, trying to solve, I was given wsdl file I Generate client from it and try to register in SOAP post cap with the parameters username and password. but in the end leaves me a message vlozhey non-support.
I wrote a class, and prescribe it in the class are automatically generated

import java.security.MessageDigest;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.activation. *;

import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;

import org.apache.axis.AxisFault;
import org.apache.axis.Constants;
import org.apache.axis.Message;
import org.apache.axis.MessageContext;
import org.apache.axis.handlers.BasicHandler;
import org.apache.axis.message.MessageElement;
import org.apache.axis.message.PrefixedQName;
import org.apache.axis.message.SOAPEnvelope;
import org.apache.axis.message.SOAPHeaderElement;
import org.apache.axis.utils.Mapping;
import org.apache.axis.utils.Messages;

public class WsseClientHandler extends BasicHandler {

private static final String WSSE_URI = ";
private static final String WSU_URI = ";
private static final String WSSE_DO13 = ";


public WsseClientHandler () {
/ / TODO Auto-generated constructor stub
}

@ Override
public void invoke (MessageContext msgContext) throws AxisFault {
/ / TODO Auto-generated method stub
System.out.println ("Enter: WsseClientHandler :: invoke");
try {
Message msg = msgContext.getRequestMessage ();
/ / Message msg = msgContext.getCurrentMessage (); / / msgContext.getRequestMessage ();
SOAPEnvelope se = msg.getSOAPEnvelope ();
se.addAttribute (Constants.URI_SOAP11_ENV, "mustUnderstand", "1");

SOAPHeaderElement wsseSecurity = new SOAPHeaderElement (new PrefixedQName (WSSE_URI, "Security", "wsse"));
MessageElement usernameToken = new MessageElement (WSSE_URI, "wsse: UsernameToken");

MessageElement username = new MessageElement (WSSE_URI, "wsse: Username");
username.setValue (msgContext.getUsername ());
usernameToken.addChild (username);
System.out.println (username);

MessageElement password = new MessageElement (WSSE_URI, "wsse: Password");
password.addAttribute (WSSE_URI, "Type", "wsse: PasswordDigest");
password.setValue (msgContext.getPassword ());
usernameToken.addChild (password);

System.out.println (password);

wsseSecurity.addChild (usernameToken);
wsseSecurity.setActor (WSSE_DO13);

se.addHeader (wsseSecurity);

System.out.println (wsseSecurity);
}
catch (Exception e) {
System.err.print ("exception00");
e.printStackTrace ();
throw AxisFault.makeFault (e);
}
System.out.println ("Exit: WsseClientHandler :: invoke - ok");
}

}

/ * Call before the call to continue
/ / Define a username and password

I put this piece into a class Pass_webserv_do13SoapBindingStub.

String clntUserName = "test001";
String clntPassword = "r03test";
_call.setUsername (clntUserName);
_call.setPassword (clntPassword);
/ / Override the handler for the request
_call.setClientHandlers (new WsseClientHandler (), null);


and compile a client

after compilation error goes

exception: java.lang.RuntimeException: No support for attachments
Previous Topic:Selection must be WSDL
Next Topic:Custom Validation of custom content type
Goto Forum:
  


Current Time: Mon Sep 01 10:07:58 EDT 2014

Powered by FUDForum. Page generated in 0.04080 seconds