How to send image through axis2 - axis2

My Service class designed through Axis2, I am able to send any data type of resords like
(premetive datatypes). I don't know how to send Image file.

Have a read of the documentation - its very good for Axis2 -> http://axis.apache.org/axis2/java/core/docs/mtom-guide.html
There are some code examples in there too on how to transfer images using Axis2

Use soap with attachment option or MTOM..Following posts are helpful
http://www.ibm.com/developerworks/webservices/library/ws-soapatt/
http://www.keith-chapman.org/2008/09/attachments-mtom-swa-and-base64binary.html

Related

Mule Web Service Consumer Warning : Operation Messages With More then 1 Part Are Not Supported

Hi I am working with Mule Web Service Consumer and i was trying to call operation with Multiple Parameters it is warning me that
Warning : Operation Messages With More then 1 Part Are Not Supported
I just want to pass multiple parameters to access my SOAP method to achieve the task.
Is this the problem with Web Service Consumer or is their any way to deal with this.
I'm afraid this is a known limitation of the web services consumer. However you can accomplish this with the cxf component.
I having the same issue and found some information around it ...
There is a improvement logged in JIRA, may help if you vote for it :)
This link suggests that you can still use WSConsumer but need to do some hand crafting of the request XML ... I could not understand what that exactly it meant so if anyone has an example on it would be great
PS: The problem I had with using CXF component is that it does not play well with the new Dataweave transformer as the Dataweave needs to be placed within the response block and from there it cannot datasense the response coming out from the CXF component
The Solution here is very simple. You just have to comment other messages and then load metadata for non-commented message (for one which you're trying to load metadata). Repeat this procedure for all the other messages and you're good to go.
Hope this helps !

What is http multipart request?

I have been writing iPhone applications for some time now, sending data to server, receiving data (via HTTP protocol), without thinking too much about it. Mostly I am theoretically familiar with process, but the part I am not so familiar is HTTP multipart request. I know its basic structure, but the core of it eludes me.
It seems that whenever I am sending something different than plain text (like photos, music), I have to use a multipart request. Can someone briefly explain to me why it is used and what are its advantages?
If I use it, why is it better way to send photos that way?
An HTTP multipart request is an HTTP request that HTTP clients construct to send files and data over to an HTTP Server. It is commonly used by browsers and HTTP clients to upload files to the server.
What it looks like
See Multipart Content-Type
See multipart/form-data
As the official specification says, "one or more different sets of data are combined in a single body". So when photos and music are handled as multipart messages as mentioned in the question, probably there is some plain text metadata associated as well, thus making the request containing different types of data (binary, text), which implies the usage of multipart.
I have found an excellent and relatively short explanation here.
A multipart request is a REST request containing several packed REST requests inside its entity.

Sending a file from a java client to a server using wcf method?

I want to build a wcf web service so that the client and the server would be able to transfer files between each other. Do you know how I can achieve this? I think I should turn it into a byte array but I have no idea how to do that. The file is also quite big so I must turn on streamed response.
It sounds like you're on the right track. A quick search of the interwebz yielded this link: http://www.codeproject.com/Articles/166763/WCF-Streaming-Upload-Download-Files-Over-HTTP
Your question indicates that you want to send a file from a java client to a WCFd endpoint, but the contents of your question indicate that this should be a bidirectional capability. If this is the case, then you'll need to implement a service endpoint on your client as well. As far as that is concerned, I cannot be of much help, but there are resources out there like this SO question: In-process SOAP service server for Java
As far as practical implementation, I would think that using these two links you should be able to produce some code for your server and client.
As far as reading all bytes of a file, in C# you can use: File.ReadAllBytes It should work as in the following code:
//Read The contents of the file indicated
string fileName = "/path/to/some/file";
//store the binary in a byte array
byte[] buffer = File.ReadAllBytes(fileName);
//do something with those bytes!
Be sure to use the search function in the future:

uploading files from iOS to web service

I have an app on the roll that requires me to upload files from it to a webservice. I am basically a noob in file transfer and in app-webservice comunications and would appreciate a direction in which to go.
The first question is how to encode the file? The webservice has to interpret the data sent so in which way do i do it? I don't own the webservice so i don't know how they pick up files, but i assume in a XML/JSON format.
The second question is how am i to send it? Having a XML object, how do i send it to, let's say, "http://www.website.com/path/to/upload". Is Async available?
If i'm missing or am wrong about a step (or 10) please correct me! Your help is much appreciated!
1: If it is a XML you will need to parse it, and create objet from it. If it's a Json, i recommend you https://github.com/johnezang/JSONKit JSONKIt, which is really awesome.
2: You 'll need get that data from webService and ASIHTTP is a really great tool to get fast web service call. The doc is really clear and comprehensible http://allseeing-i.com/ASIHTTPRequest/ is a must have.
3: You send your data either by url (get) or post.
Hope for you it's not into XML format, this is really painful, believe me

How to parse WCF binary response manually (xml)

I need to parse WCF binary response. The reason is that I have no contract nor metadata I can just call wcf service with parameters using WebClient. What I'm getting now is binary response with xml inside but when I want to deserialize it with BinaryFormatter and load xml document, it gives me an error because of leading data. Is there some class which can do this for me?
Thanks.
I was also looking for something similar and I came across https://github.com/waf/WCF-Binary-Message-Inspector
It may help you out.
thank you for responses. Actually I ended up following this blog post (Fiddler plugin):
http://blog.functionalfun.net/2009/11/fiddler-plug-in-for-inspecting-wcf.html
there is also a link to source code:
http://archive.msdn.microsoft.com/wcfbinaryinspector
hope it will help