Avatar billede linebille Nybegynder
09. november 2005 - 11:09 Der er 3 kommentarer

DII webservice klient

jeg laver en webservice klient til en document/literal webservice.

..men hvad skal jeg give call.invoke med som parameter?,  et xmldokument med hvad der skal være i soapbody'en, eller skal jeg opbygge hele soapenvelopen selv og sende afsted?

øøh, er det forståeligt? :-)
Avatar billede linebille Nybegynder
09. november 2005 - 11:25 #1
altså jeg gør sådan:

String serviceEndpoint = "http://localhost:8080/myapp/SimpleService";
javax.xml.rpc.ServiceFactory factory = ServiceFactory.newInstance();     
javax.xml.rpc.Service service = factory.createService(new QName(qnameService));
QName port = new QName(qnamePort);           
QName operation = new QName BODY_NAMESPACE_VALUE, operationName);           
Call call = service.createCall(port,operation);     
call.setTargetEndpointAddress(serviceEndpoint);
call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(false));//TRUE??
call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
call.setProperty(ENCODING_STYLE_PROPERTY, "");
call.setProperty(Call.OPERATION_STYLE_PROPERTY, "document");
QName REQUEST_QNAME = new QName(TYPE_NAMESPACE_VALUE, messagePartElement);
call.addParameter("", REQUEST_QNAME,ParameterMode.IN);     
QName RESPONSE_QNAME = new QName(TYPE_NAMESPACE_VALUE, messagePartElement);
call.setReturnType(RESPONSE_QNAME, Document.class);

Object[] param = {report};
result = (Document) call.invoke(param);
           
result og resport er af typen org.w3c.dom.Document.
Avatar billede linebille Nybegynder
09. november 2005 - 11:53 #2
resport = report

Det er vel en SOAPEnvelope jeg skal bruge som parameter.

hvis jeg gør det sådan:

call.setReturnType(RESPONSE_QNAME);

MessageFactory m = MessageFactory.newInstance();           
SOAPMessage env = m.createMessage();
SOAPMessage responsEnv = m.createMessage();           
Object[] param = {env};
System.out.println("invoking...");
responsEnv =  (SOAPMessage) call.invoke(param);   

får jeg:

2005-11-09 11:47:10 org.apache.axis.attachments.AttachmentsImpl getAttachmentCount
WARNING: Exception:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.io.IOException: No serializer found for class org.apache.axis.Message in registry org.apache.axis.encoding.TypeMappingDelegate@148662
faultActor:
faultNode:
faultDetail:
    {http://xml.apache.org/axis/}stackTrace:java.io.IOException: No serializer found for class org.apache.axis.Message in registry org.apache.axis.encoding.TypeMappingDelegate@148662
    at org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1429)
    at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:914)
    at org.apache.axis.message.RPCParam.serialize(RPCParam.java:200)
    at org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:433)
    at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
    at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:139)
    at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:477)
    at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
    at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
    at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
    at org.apache.axis.SOAPPart.saveChanges(SOAPPart.java:530)
    at org.apache.axis.attachments.AttachmentsImpl.getAttachmentCount(AttachmentsImpl.java:519)
    at org.apache.axis.Message.getContentType(Message.java:475)
    at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:343)
    at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
    at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
    at org.apache.axis.client.Call.invoke(Call.java:2748)
    at org.apache.axis.client.Call.invoke(Call.java:2424)
    at org.apache.axis.client.Call.invoke(Call.java:2347)
    at org.apache.axis.client.Call.invoke(Call.java:1804)
    at test.client.TestClient.main(TestClient.java:92)

    {http://xml.apache.org/axis/}hostname:medcom

java.io.IOException: No serializer found for class org.apache.axis.Message in registry org.apache.axis.encoding.TypeMappingDelegate@148662
    at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
    at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:317)
    at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
    at org.apache.axis.SOAPPart.saveChanges(SOAPPart.java:530)
    at org.apache.axis.attachments.AttachmentsImpl.getAttachmentCount(AttachmentsImpl.java:519)
    at org.apache.axis.Message.getContentType(Message.java:475)
    at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:343)
    at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
    at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
    at org.apache.axis.client.Call.invoke(Call.java:2748)
    at org.apache.axis.client.Call.invoke(Call.java:2424)
    at org.apache.axis.client.Call.invoke(Call.java:2347)
    at org.apache.axis.client.Call.invoke(Call.java:1804)
    at test.client.TestClient.main(TestClient.java:92)
Caused by: java.io.IOException: No serializer found for class org.apache.axis.Message in registry org.apache.axis.encoding.TypeMappingDelegate@148662
    at org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1429)
    at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:914)
    at org.apache.axis.message.RPCParam.serialize(RPCParam.java:200)
    at org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:433)
    at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
    at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:139)
    at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:477)
    at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
    at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
    ... 16 more
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.io.IOException: No serializer found for class org.apache.axis.Message in registry org.apache.axis.encoding.TypeMappingDelegate@148662
faultActor:
faultNode:
faultDetail:
    {http://xml.apache.org/axis/}stackTrace:java.io.IOException: No serializer found for class org.apache.axis.Message in registry org.apache.axis.encoding.TypeMappingDelegate@148662
    at org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1429)
    at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:914)
    at org.apache.axis.message.RPCParam.serialize(RPCParam.java:200)
    at org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:433)
    at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
    at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:139)
    at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:477)
    at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
    at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
    at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
    at org.apache.axis.SOAPPart.saveChanges(SOAPPart.java:530)
    at org.apache.axis.SOAPPart.getContentLength(SOAPPart.java:229)
    at org.apache.axis.Message.getContentLength(Message.java:499)
    at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:371)
    at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
    at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
    at org.apache.axis.client.Call.invoke(Call.java:2748)
    at org.apache.axis.client.Call.invoke(Call.java:2424)
    at org.apache.axis.client.Call.invoke(Call.java:2347)
    at org.apache.axis.client.Call.invoke(Call.java:1804)
    at test.client.TestClient.main(TestClient.java:92)

    {http://xml.apache.org/axis/}hostname:medcom

java.io.IOException: No serializer found for class org.apache.axis.Message in registry org.apache.axis.encoding.TypeMappingDelegate@148662
    at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
    at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:317)
    at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
    at org.apache.axis.SOAPPart.saveChanges(SOAPPart.java:530)
    at org.apache.axis.SOAPPart.getContentLength(SOAPPart.java:229)
    at org.apache.axis.Message.getContentLength(Message.java:499)
    at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:371)
    at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
    at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
    at org.apache.axis.client.Call.invoke(Call.java:2748)
    at org.apache.axis.client.Call.invoke(Call.java:2424)
    at org.apache.axis.client.Call.invoke(Call.java:2347)
    at org.apache.axis.client.Call.invoke(Call.java:1804)
    at test.client.TestClient.main(TestClient.java:92)
Caused by: java.io.IOException: No serializer found for class org.apache.axis.Message in registry org.apache.axis.encoding.TypeMappingDelegate@148662
    at org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1429)
    at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:914)
    at org.apache.axis.message.RPCParam.serialize(RPCParam.java:200)
    at org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:433)
    at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
    at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:139)
    at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:477)
    at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
    at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
    ... 16 more
???
Avatar billede linebille Nybegynder
09. november 2005 - 15:29 #3
haha..ved ik hva jeg tænkte, slog op i en bog - fandt hvad jeg søgte. :-)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester