You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Thomas Zöchling <th...@gmx.at> on 2004/06/21 00:15:35 UTC
.net Webservicem, AXIS client: DIME Attachment from Server
Hello List
I am trying to consume a .net Webservice that responds a DIME attached
image.
The call properly arrives at the service but the reponse raises serveral
SaxParseExceptions.
I tried to force Attachment Format by hardcoding this
_call.setProperty(org.apache.axis.client.Call.ATTACHMENT_ENCAPSULATION_FORMA
T,org.apache.axis.client.Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
to the generated *SoapStub.java. But without success ->Same Exception
Thx for reading Thomas
Here is the Stack trace:
{http://xml.apache.org/axis/}stackTrace: org.xml.sax.SAXParseException:
Zeichenumwandlungsfehler: "Malformed UTF-8 char -- is an XML encoding
declaration missing?" (Zeilenzahl möglicherweise zu niedrig)
at
org.apache.crimson.parser.InputEntity.fatal(InputEntity.java:1100)
at
org.apache.crimson.parser.InputEntity.fillbuf(InputEntity.java:1072)
at
org.apache.crimson.parser.InputEntity.isXmlDeclOrTextDeclPrefix(InputEntity.
java:914)
at
org.apache.crimson.parser.Parser2.maybeXmlDecl(Parser2.java:1009)
at
org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:486)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at
org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationCon
textImpl.java:242)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
at org.apache.axis.client.Call.invoke(Call.java:2553)
at org.apache.axis.client.Call.invoke(Call.java:2248)
at org.apache.axis.client.Call.invoke(Call.java:2171)
at org.apache.axis.client.Call.invoke(Call.java:1691)
at
attService.AttServiceSoapStub.getImage(AttServiceSoapStub.java:102)
at
attService.imageRequestor.requestImage(imageRequestor.java:76)
at attService.imageRequestor.saveImage(imageRequestor.java:91)
at
attService.imageRequestor$1.actionPerformed(imageRequestor.java:43)
at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1767)
at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButto
n.java:1820)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:4
19)
at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener
.java:258)
at java.awt.Component.processMouseEvent(Component.java:5021)
at java.awt.Component.processEvent(Component.java:4818)
at java.awt.Container.processEvent(Container.java:1380)
at java.awt.Component.dispatchEventImpl(Component.java:3526)
at java.awt.Container.dispatchEventImpl(Container.java:1437)
at java.awt.Component.dispatchEvent(Component.java:3367)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3214)
at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:2929)
at
java.awt.LightweightDispatcher.dispatchEvent(Container.java:2859)
at java.awt.Container.dispatchEventImpl(Container.java:1423)
at java.awt.Window.dispatchEventImpl(Window.java:1566)
at java.awt.Component.dispatchEvent(Component.java:3367)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
va:190)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:144)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
This is the .net Service:
[WebMethod]
public string GetImage(string imageName)
{
SoapContext myContext = HttpSoapContext.ResponseContext;
string filePath = "C:\\inetpub\\wwwroot\\attService\\" +
imageName + ".jpg";
DimeAttachment dimeImage = new DimeAttachment("image/jpeg",
TypeFormatEnum.MediaType,filePath);
//dimeImage.Id = "uri:" + Guid.NewGuid().ToString();
dimeImage.Id = "uri:temp.jpg";
try
{
myContext.Attachments.Add(dimeImage);
}
catch(Exception e)
{
e.ToString();
}
return dimeImage.Id;
}
}
Clientcode (Stub generated from WSDL)
public DataHandler requestImage() throws RemoteException
{
String test=port.getImage(txtImage.getText());
Object[] obj =
((org.apache.axis.client.Stub)port).getAttachments();
// assuming one attachemnt only
//Each Attachment is actually an AttachmentPart - we only have 1
AttachmentPart p = (AttachmentPart) obj[0];
// from the part we may get the dataHandler
DataHandler dh = p.getActivationDataHandler();
return dh;
}