Passing a MailMessage object to a web service - web-services

Can anyone please tell me if it's possible to pass a
System.Web.Mail.MailMessage object to a ASP.NET Web Service? Maybe using XML
Serialization / Deserialization? I've been asked to investigate the
possibility of building a front-end web page which captures MailMessage
properties such To, From Subject, Attachments etc, builds a MailMessage
object, passes the MailMessage object to a web service, the web service then
sends the message via the Smtp.Send method.
Any assistance gratefully received. Thanks!

Certainly this can be done using web services. WCF would make this extremely simple. Just create a new WCF web service and the method would look something like this:
[WebMethod]
public bool ReceiveMailMessage(MailMessage mm)
{
//Send the MM
return true;
}

Related

How to pass collection<?> over JAX-WS web service

In my project I need to write a web service which will receive Collection<?> as a parameter.. I am using apache CXF.. After I have written the service method I am unable to test it using SOAP UI (It is not generating any request).. My question is - Is it possible to receive Collection<?> over web service? I need to receive Collection of any object type.. Please help..
You need to work directly with SOAP messages.

How to create SOAP client with spring application

I need to create a client with WSDL. I have a Java web application with JSF, Spring and JPA. In this application I need to create a form and send the info to the SOAP web service. This service should return another object with status.
Please, any idea I will be grateful
regards
sorry by my english
I assume you have generated classes from the WSDL needed for you client. In Spring it is very simple by using Apache CXF. For e.g.:
<jaxws:client id="yourService"
serviceClass="com.something.YourService"
address="the URL of web service"
username="username"
password="password"/>
And in your class where you need to call this web service just autowire it:
#Autowired
#Qualifier("yourService")
private YourService service;
Take a look at the example: http://cxf.apache.org/docs/writing-a-service-with-spring.html

Send/Receive a SOAP request using SPRING JAVA

I am new to Spring web services. I am going to create an xml request, and send it as a SOAP request to a web service and receive the response.I read different documents but still confused as I could not find a working sample yet.
I know that I should use WebServiceTemplate and WebServiceMessageSender, SaajSoapmessageFactory (please let me know if I am wrong) but not sure how to use them.
Do I need WSDL? if yes why?
If you have any sample code please send me to get clear on it.
Thanks
If you want to send SOAP requests, you would like to be a SOAP client. Seems like you want to use spring-ws project. Check out their great documentation on the client side. The same documentation will guide you through the process of creating a server. There are plenty of examples and ready-made configuration snippets waiting for you.
Spring-WS is built on top of XML Schema description of your message, so you will need WSDL to generate e.g. JAXB models of your requests and responses.
AFAIK, for "web services" , the WSDL file is the machine blueprint of the "ports" as they are called However! ports in WSDL "means" java language(or any other programming language used with a routine or sub or procedure or function) method and has a specific naming scheme associate the .wsdl xml file(template of the service). Each WSDL port(language method) has specifications of return value and data specifications for how to feed it arguments and their type values.

BizTalk web service to return a value rather than void + ref

Is there anyway to get the web service generated by the BizTalk Web Services Wizard for an orchestration to return a value, rather than it have a void return and it use return by ref ?
I'm trying to emulate an existing web service which is very simple ... the web method takes a string and returns a string ... public string MyTestMethod(string MyVal)
The proxy to the web service from the orchestration works, but the BizTalk wizard generates ... public void MyTestMethod (ref string MyVal)
I've tried the Advanced option, Force Request Response, but that doesn't seem to do anything
Are you trying to publish an Orchestration as a web service or Schema as a service?
Considerations while using the web service wizard : http://technet.microsoft.com/en-us/library/aa559660(BTS.20).aspx ... for 2006 R2
The only answer I found was to manually edit the ASMX.CS file that the BizTalk Web Service Publishing Wizard generates ...
Change the ElementName on the methods in parameter ... ([XmlElement(Namespace = null, ElementName = "XML")] string part)
Completely remove the ... [return: System.Xml.Serialization.XmlElementAttribute ...] attribute
Plus adjust the WebService(Name="", Namespace="",...) values to suit
This of course means that you can't just re-generate with the Wizard :-(
I know it's a quite old post, but just in case some else comes to it: I managed to do it as suggested by Tom Redfern above. It works perfectly if your inbound orchestration port is two-way.
In my case I had to expose an orchestration as WCF service where my orchestration receives a domain (e.g. "gmail.com") as input parameter, does some processing and at the end executes a stored procedure that fetches a list of e-mails belonging to that domain. So I had a "Domain" as input and "ListOfUsers" as output. Having my inbound orchestration port as "TWO-WAY" allowed me to receive a message of type "Domain" and output message of type "ListOfUsers".
Afterwards I could use "BizTalk WCF Service Publishing Wizard" and it generates it perfectly. Just had to adjust namespaces, port names, application pool and etc. and all good! Tried using SoapUI and works brilliant!

Send XML file to Web Service using Java

I want to send an XML file to a Web Service.
The Web Service is a java application.
I know the endpoint of the Web Service.
Typically I know I have to create the request and send it as an http/https request.
What I want to know is what would I have to make to send the request - as in what development tool could I use e.g. Visual Web Developer (preffered as I am familiar with this) or Visual Studio? And what sends the request - e.g. another Web Service, a Website etc?
Where do I even begin with this?
Any comments are much appreciated.
Where do I even begin with this?
One purpose of a Webservice is loose coupling. So it depends on what you want to do. You can write a simple program in what ever language which constructs a request and sends it. You can write a Webservice on its own which uses the other Webservice to handle it's own requests.
You can handle this in a very simple or complex way. You only need to be able to generate a request (per xml) and send it.