Asp net - web service to post files

Hi, I need to create a web service wich use will be to receive binary files, what I want is that the web service accept post methods with files and then save this files to the disk.
Better if your solution works with asp .net 2.0 because it's the framework installed in my server.
luis molina

Hello,
   This could help you.
   http://support.microsoft.com/kb/318425
[WebMethod]
public bool SaveDocument( Byte[] docbinaryarray, string docname)
string strdocPath;
strdocPath = "C:\\DocumentDirectory\\" + docname;
FileStream objfilestream =new FileStream(strdocPath,FileMode.Create,FileAccess.ReadWrite);
objfilestream.Write(docbinaryarray,0,docbinaryarray.Length);
objfilestream.Close();
return true;
[WebMethod]
public int GetDocumentLen(string DocumentName)
string strdocPath;
strdocPath = "C:\\DocumentDirectory\\" + DocumentName;
FileStream objfilestream = new FileStream(strdocPath,FileMode.Open,FileAccess.Read);
int len = (int)objfilestream.Length;
objfilestream.Close();
return len;
[WebMethod]
public Byte[] GetDocument(string DocumentName)
string strdocPath;
strdocPath = "C:\\DocumentDirectory\\" + DocumentName;
FileStream objfilestream = new FileStream(strdocPath,FileMode.Open,FileAccess.Read);
int len = (int)objfilestream.Length;
Byte[] documentcontents = new Byte[len];
objfilestream.Read(documentcontents,0,len);
objfilestream.Close();
return documentcontents;
 if the reply help you mark it as your answer.
 Free Managed .NET Excel, Word, PDF Component(Create,
Modify, Convert & Print)

Similar Messages

  • File to Web service (SOAP) to File scenario with out BPM in PI 7.1

    Hi All,
    I have scenario File to Web service (SOAP) to File scenario with out BPM.i am getting the below error:
    1) Error MP: unexpected exception caught com.sap.aii.af.service.cpa.impl.exception.CPAObjectKeyException: Value of key must not be null: ObjectId
    2) Error ROB: error during processing: com.sap.aii.af.lib.mp.processor.ModuleProcessorException: Processing Error
    PI server is 7.1 with SP:8
    I have configured the scenario like this
    1) 2 File channels - Sender & Receiver ,1 RFC channel - Receiver. We need to note that, the additional Module parameters need to be added only for sender File channel
    2) Created Sender Agreement
    3)Created Receiver Determination
    4)Created Interface Determination
    5)Created Receiver Agreement
    Regards,
    Ramesh

    Hi,
    Thanks for your reply!!
    My Scenario is File to SOAP to File.
    Configred modules  in Sender channal below:
    Prcessing sequence:
    Number       Module Name                                        Module Key
    1..........       AF_Modules/RequestResponseBean.......1
    2..........       CallSapAdapter..........................................2
    3..........       AF_Modules/ResponseOnewayBean.......3
    Module Configuration:
    Module Key                                       Parameter Name                                       ParameterValue
    1                                                        passThrough                                            true
    3                                                        receiverChannel                                       receiverChannel name
    3                                                        receiverService                                        receiverService name
    please tell any more confiration requered.
    Regards,
    Ramesh

  • Problem calling dot net Web Services from J2ME

    A different angle: must I register my (dot net) Web Service with UDDI for it to be callable form a java app? - the java doc I'm now reading implying this UDDI registration is a MANDATORY step!

    I "fixed" this problem by commenting out the User-Agent setting in KSOAP

  • Plumtree Crawler Web Services for NT File Systems

    Hi,
    I'm working with Corporate portal v5.0.4J. I'm trying to figure out if the 'crawler web services for NT file systems' are build into the portal or whether it is an optional component that needs to be installed?
    Any info is appreciated.
    J

    The Windows Files Content Service is a separate component from the portal. You can download this component from the Product Center.
    -Paul

  • Newbie | Invoking a Dot Net Web Service

    Hey,
    I need to call a web service built in .net in one of my java files. How can I do this?
    I think HttpUrlConnection class is used for this. Can someone please share some sample code?
    Anticipating,
    Nick

    I'll give you a tip in stead. See that textbox to the left of this page? It has a label "search forums". Using it you can search this forum! I myself have already posted the example code to use URLConnection many times, and I'm not the only one who did.
    Another tip: never bluntly ask for example code. People here like to help you with a problem, but they hate having to do the work for you.

  • Web Services from WSDL file

    Hi there. I am new for Java Web Services.
    I'm trying to generate a web service from a .wsdl file. This file includes a references to other .xsd files
    and that's the problem.
    First I've tried with JBuilder 9 but it gave me some problems with some element definitions from xsd file (such as those elements defined as 'choice'): there were generated some classes with repeated elements (such as variables and methods), some classes with strange names (it was added a 'TypeN' label to the name of the class), etc.
    Then I've tried with Sun One Studio 5. It didn't support 'include' tags in the wsdl file.
    Later I've tried with Weblogic Workshop but an error with an internal class of Weblogic was generated.
    Can anyone tell me what editor could I use to generate the Java Web Services?
    Thanks!

    https://jax-rpc.dev.java.net/whitepaper/1.1/index-part2.html explains in detail how to develop, deploy and invoke a web service starting from a WSDL.
    Let me know if you have any specific questions.
    Thanks,
    -Arun

  • Calling a Web Service with a File Binding Component

    Is it possible to call a web service (inside a bpel process) using a File Binding Component?
    It seems that the File Binding Component should read an XML representing the input - is this possible? I found something about an "input-file-type" for the message, is this the way?
    Thank you,
    Marcos Ackel

    Hi
    " have done one small application with Bpel which read messages from port and write to file in xml format using file binding........"
    By your description of this application, I'm sure it is using the HTTP BC to read incomming messages, and then the File BC to write them to a file. I think the original question is whether the File BC can call a web service which is very different.
    Either way, when calling Web services, the recommended BC is the HTTP BC.
    Cheers
    Paul

  • Using Native Oracle XML DB Web Services - REST POST web service possible?

    My goal is to expose some pl/sql procedures as a REST web services.
    The Database is 11gR2
    The request method needs to be a POST (not GET as a request will perform insert/updates ) - the request body will contain a xml structure
    Have setup XMLDB Database-native Web Services as per
    11g documentation "Using Native Oracle XML DB Web Services"
    It seems this setup support only SOAP requests!?
    RESTful webservice with GET is (sort of) supported using
    Embedded PL/SQL Gateway as describer here:
    http://ora-00001.blogspot.com/2009/07/creating-rest-web-service-with-plsql.html
    Although no support for POST
    Obviously the post is from 2009 so just want to know if anything changed since.
    Has anyone found a way to expose pl/sql procedures using XML DB or other approach as a REST POST web services?
    (As the relative low number of calls/hour and also the aim to have the least amount of moving parts therefor looking for a DB centric solution)
    Thanks
    Pete

    I think the post referred to was more an exercise of what could be achieved. The quickest way, nowadays, to get this done with not too much hassle is via APEX
    http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35128/restful_svc.htm
    M.

  • Web Services with POST Bindings

    Hi,
    I am creating a web service with a method which takes a value from the user and inserts the value into the database .Now the value which is taken is of type 'long' and cannot be sent through the URL.
    As far as my understanding goes, the default SOAP binding that I am using currently uses the HTTP GET method,ie through the URL, to send the SOAP request. But the problem is that my Request is too big and I have to use the HTTP POST method.
    Now, my questions are as follows:
    1.Instead of using the default SOAP binding, can I use the HTTP POST bindings? IF yes, How do I go about it?
    2.Is there a way to specify to the SOAP to use HTTP POST( for example in the 'transport' attribute)?
    Thanks,
    Ramya.

    Normally, Oracle's stack expects a post binding and the SOAP client does it for you this way under the covers [1].
    We did add a get binding so that if you came in via a browser in Oracle9iAS 9.0.3 and OracleAS 10g 9.0.4 and later - we generate a home page and a parameter form from which you can test out the Web service when coming in via a browser.
    What SOAP client are you using? Are you constructing your own SOAP message, using Oracle's SOAP libraries or another package?
    Mike.
    [1]
    Sample SOAP client using Oracle's SOAP libraries
    public String sahHello(String test) throws Exception
    String returnVal = null;
    URL endpointURL = new URL(_endpoint);
    Call call = new Call();
    call.setSOAPTransport(m_httpConnection);
    call.setTargetObjectURI("MyWebService1");
    call.setMethodName("sayHello");
    call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
    Vector params = new Vector();
    params.addElement(new Parameter("test", java.lang.String.class, test, null));
    call.setParams(params);
    call.setSOAPMappingRegistry(m_smr);
    Response response = call.invoke(endpointURL, "");
    if (!response.generatedFault())
    Parameter result = response.getReturnValue();
    returnVal = (String)result.getValue();
    else
    Fault fault = response.getFault();
    throw new SOAPException(fault.getFaultCode(), fault.getFaultString());
    return returnVal;

  • Error when running the Web Services java client file

    Hi,
    I am working on web services with 9iAS.
    I am using the StatelessExample file included during installation.
    The ear file was created and the application was deployed using OEM Web.
    But when I try to execute the client java file StatelessClient. I get an error. The error is something about content type.
    The error message is pasted below.
    And also how do I run the web service on the browser.
    Please help.
    regards
    Kamlesh
    D:\ora9ias_portal\j2ee\home\demo\web_services\java_services\client>java -classpa
    th .;StatelessExample_proxy.jar;%CLASSPATH%; StatelessClient
    Exception in thread "main" [SOAPException: faultCode=SOAP-ENV:Protocol; msg=Unsu
    pported response content type "text/html", must be: "text/xml&quo
    t;. Response was:
    <HTML><HEAD><TITLE>500 Internal Server Error</TITLE><
    /HEAD><BODY><H1>500 Internal Server Error</H1><PRE>or
    acle.j2ee.xanadu.JasperGenerationError: no source generated during code generati
    on!: 1 in getFile name: oracle\j2ee\ws_example\StatelessExample.class
    <br>1 in getFile name: oracle\j2ee\ws_example\StatelessExample.java
    <br>error: error message 'class.format' not found<br>binar
    y class definition not found: oracle.j2ee.ws_example.StatelessExample
    <br>
    <br>      at oracle.j2ee.ws.JavaWrapperGenerator.generate(JavaWrapperGener
    ator.java:267)
    <br>      at oracle.j2ee.ws.RpcWebService.generateWrapperClass(RpcWebServi
    ce.java:662)
    <br>      at oracle.j2ee.ws.RpcWebService.generate(RpcWebService.java:436)
    <br>      at oracle.j2ee.ws.RpcWebService.getWrapper(RpcWebService.java:76
    7)
    <br>      at oracle.j2ee.ws.RpcWebService.doPost(RpcWebService.java:309)
    <br>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:283)
    <br>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
    <br>      at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].serv
    er.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:59)
    <br> at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java
    :283)
    <br> at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].serv
    er.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:523)
    <br> at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].serv
    er.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:2
    69)
    <br> at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].serv
    er.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:735)
    <br> at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].serv
    er.http.AJPRequestHandler.run(AJPRequestHandler.java:151)
    <br> at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].util
    .ThreadPoolThread.run(ThreadPoolThread.java:64)
    <br></PRE></BODY></HTML>
    at org.apache.soap.rpc.Call.getEnvelopeString(Call.java:201)
    at org.apache.soap.rpc.Call.invoke(Call.java:260)
    at oracle.j2ee.ws_example.proxy.StatelessExampleProxy.makeSOAPCallRPC(St
    atelessExampleProxy.java:51)
    at oracle.j2ee.ws_example.proxy.StatelessExampleProxy.helloWorld(Statele
    ssExampleProxy.java:35)
    at StatelessClient.main(StatelessClient.java:8)

    If you are getting this error, then you are most likely compiling your code with a different JVM than what is shipped with the application server. Oracle9iAS Release 2 (9.0.2) uses the JDK1.3.1. I got this error when I compiled the code with JDK1.4.0_01.

  • Exporting Photos to Web Service Retaining Modified File Name

    I recently started using iPhoto 08 to edit and organize my photos. In 2008 we took nearly 10,000 pictures. I have used and would like to continue using Winkflash as my photo printing service. What I like best about Winkflash is that they print the name of the photo on the back of the pictures. Before I upload the pictures, I edit them and modify the file name to the date, who's in the picture, and where the event is. When my photos arrive, I don't have to label the back as all the information is already there.
    In November I started using iPhoto 08. After editing and renaming (using the Batch Change > Title option) and entering information about each picture in the title frame on over 2,000 photos, I started uploading them to Winkflash. Much to my dismay, the file name was not retained. ARGHHH! (To rename the photos, I use the international date format so the pictures are chronological; i.e. 20081231 New Year Eve - 01 Ron)
    I used Winkflash's image uploader and dragged and dropped the images from iPhoto. Why is it not retaining the file name but reverting back to the camera's IMG_XXX?
    Message was edited by: blondiedo

    Because adding a Title is not the same a renaming a file.
    Select the pics in the iPhoto Window and go File -> Export. In the resulting dialogue you have the option (among others) to set the Kind: to JPEG and then to use the Title as Filename. Complete the export to the desktop where iPhoto will make a copy of the files with your desired filename. Upload those.
    Failing that, ask your Print Service to support standard IPTC metadata.
    Regards
    TD

  • How to get contents of Soap Over JMS web service's wsdl file

    Hi,
    Is there a way to get the soap over jms webservice's wsdl file in browser? if yes please provide me the details how to get it.
    OR how can i get the contensts of WSDL file for soap over jms wsdl file.
    thanks in advance.

    I have the same question ("Assuming I can generate a wsdl file, can I recreate the SOAP request message from the WSDL file automatically (that matches the original request, which is hand build by me?)")
    Have you already found an answer to this?

  • Web Service Development

    I am trying to create a web service in visual studios 2010. I have followed the directions from the Microsoft web site, but my service does not display correctly. Please help

    Hi Mike,
    Thank you for posting in MSND forum.
    Based on your issue, could you please share me the link about you create a web service followed the directions from the Microsoft web site?
    In addition, I suggest you can try to create a new simple web service project and then check if the issue is related to the specified web service project or all projects in VS2010 IDE.
    (1) If you can create a other type project, I doubt that the issue is related to the specified web service project, so I suggest you can try ask this issue to the ASP.NET Web Service forum:
    http://forums.asp.net/28.aspx/1?WCF+ASMX+and+other+Web+Services , you will get better support.
    In addition, I find some similar thread about your issue, please refer it.
    http://forums.asp.net/t/1597083.aspx?How+to+create+simple+web+service+in+VS2010+NOT+WCF+service
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/64ecbe59-ec7b-4247-b430-95619e814a3e/create-a-web-service-in-c?forum=csharpgeneral
    (2) If you still could not create a other type project, I think that maybe you will need to repair or re-install the VS2010 and then reset your VS setting file check this issue again.
    Hope it help you!
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to access and display a Web Service from a WSDL in JSP or JSTL ?

    Dear All,
    We need to access a Web Service which is hosted as WSDL How to access a WSDL file from JSP or JSTL, parse and display the SOAP response in JSP page.
    Any simple example or URL as reference to an example will be useful for me.
    It seems io tags of jakarta is able to send soap message, but how to display it in JSP.
    Yours,
    Sankar.B

    Dear Sir,
    Yes. I would like to know more about the Forte and how to consume WSDL file from JSTL. The following are my querirs.
    1. How to connect the declared JNDI from a JSP page. i.e: the Datasource - ex: booksDS
    2. We connect the Tomcat server using JNDI as jdbc/scott. But, if I give jdbc/scott in JSTL as datasource={jdbc/scott}, we could not able to connect. We use the following code in a JSP page to connect the DB from a JSP page. (Its quite easy to modify, so we use the connection in a JSP page.)
    3. How to Consume a WSDL url from JSTL. Ex: If there is a URL : http://localhost/ws/MathService.asmx?wsdl OR http://www.xmethods.com/test/BabelFish
    4. How to display the result. We tried via SOAP from io taglib of Jakarta, but gives us an SOAP (it also looks like xml) response. But, how to use the value from that soap response in IE client thru JSTL/JSP.
    5. Whether this JSTL tool will be available with Forte Enterprise/Community Edition. If so EE, whats the price.
    Please Reply Immediatly. We tried, trying, going to try to display a wsdl response, but not able to display in IE thru JSP/JSTL. But, weve tested the www.gotdotnet.com examples of asp.net web services, we are thru. Its quite easy it seems in .NET. But, we feel whether even there is not even one example in JSTL/ Java Web Services Dev. Pack to utilise a web service in full cycle. The example which uve given is thru servlets. We dont use servlets. Cos, its very easy to edit JSP pages, instead of compiling the serv. and using it.
    I hope ull reply for all the above queries, since ur from SUN.
    Expecting your fav. reply.
    Yours,
    Sankar.B

  • Using credentials with a web service -- what our my options?

    Hi All,
    I'm trying to determine what options I have in regards to
    setting credential requirements on my web services. The two options
    seem to be:
    -Basic authentication
    -SOAP header authentication.
    I see that the WebService class has a "setCredentials"
    method, but I haven't had much success with it. Here's the
    documentation reference:
    http://livedocs.adobe.com/labs/flex/3/langref/mx/rpc/AbstractService.html#setCredentials()
    It says: "Set the credentials for the destination accessed by
    the service ... Note that services that use a proxy or a
    third-party adapter to a remote endpoint will need to
    setRemoteCredentials instead."
    Great, I'm not using a proxy, so I figured it would work. I
    thought I would try it with SOAP header auth. I setup a simple
    ASP.NET web service that users SOAP header auth, and decided to
    test it out. Attached is my complete MXML (I also tried using SSL).
    The Flash player threw the following error:
    [MessagingError message='Authentication not supported on
    DirectHTTPChannel (no proxy).']
    at mx.messaging.channels::DirectHTTPChannel/setCredentials()
    at mx.messaging::ChannelSet/setCredentials()
    at mx.messaging::MessageAgent/setCredentials()
    at mx.rpc::AbstractService/setCredentials()
    at SoapHeaderAuthenticatedServicesTest/handleLoad()
    at
    flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.rpc::AbstractService/dispatchEvent()
    at mx.rpc.soap::WebService/
    http://www.adobe.com/2006/flex/mx/internal::wsdlHandler()
    at
    flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.rpc.wsdl::WSDLLoader/private::checkLoadsOutstanding()
    at
    mx.rpc.wsdl::WSDLLoader/mx.rpc.wsdl:WSDLLoader::resultHandler()
    at
    flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.rpc::AbstractInvoker/
    http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
    at mx.rpc::AbstractInvoker/
    http://www.adobe.com/2006/flex/mx/internal::resultHandler()
    at mx.rpc::Responder/result()
    at mx.rpc::AsyncRequest/acknowledge()
    at private::DirectHTTPMessageResponder/completeHandler()
    at
    flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/flash.net:URLLoader::onComplete()
    at [io]
    Interesting -- "Authentication not supported on
    DirectHTTPChannel (no proxy)" -- but the docs made it sound like
    that's precisely when you were to use setCredentials. If using a
    proxy, you would use setRemoteCredentials.
    So... what's up? How do I use setCredentials? And is it for
    use with SOAP header authentication, Basic authentication, or
    something else?

    quote:
    Originally posted by:
    pete
    ...Other times you see operations requiring credentials in
    SOAP headers...
    Pete
    This is what I'm currently pursuing. I did not have much
    success with Basic authentication (didn't work at all in IE, and,
    as you mentioned, even in browsers where it worked, if the
    username/password is wrong, the Flex UI can't intercept the login
    failure, and the user gets that ugly login popup).
    But, I'm not having much success. Here's what the SOAP
    request *should* look like, for my test web service that uses SOAP
    headers for authentication. I used a Visual Studio generated proxy
    class to make this call, and it returned the expected data from the
    web service (i.e., the SOAP authentication worked).
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="
    http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="
    http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="
    http://www.w3.org/2001/XMLSchema">
    <soap:Header>
    <AuthHeader xmlns="
    http://intranet/WebServices/">
    <UserName>TestUser</UserName>
    <Password>TestPassword</Password>
    </AuthHeader>
    </soap:Header>
    <soap:Body>
    <HelloWorld xmlns="
    http://intranet/WebServices/"
    />
    </soap:Body>
    </soap:Envelope>
    Now, I want to set this up in Flex as well. Here's what I
    tried:
    // Called when the WSDL is finished loading
    public function handleLoad(event:Event):void{
    var qName : QName = new QName( "
    http://intranet/WebServices/",
    "AuthHeader" );
    var authXml : XML = <AuthHeader>
    <UserName>TestUser</UserName>
    <Password>TestPassword</Password>
    </AuthHeader>;
    var auth : SOAPHeader = new SOAPHeader( qName, authXml );
    service.addHeader(auth);
    service.HelloWorld();
    No errors are thrown by Flex, however, the SOAP
    authentication fails (I get the expected "access denied" response
    from the web service). I used Wireshark to see what traffic was
    being sent back and forth, and this is what I see for the request
    from Flex:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="
    http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:s="
    http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="
    http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Header></SOAP-ENV:Header>
    <SOAP-ENV:Body>
    <tns:HelloWorld xmlns:tns="
    http://intranet/WebServices/"/>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    Emphasis mine. Note that the SOAP header is empty -- what's
    going on?

Maybe you are looking for