BizTalk Send Flat File to Web Service - web-services

I currently have a BizTalk 2006 (r1) application which receives XML from a SQL stored proc using the SQL adapter. It maps this to another schema before sending out to a 3rd party. The send port uses a custom pipeline component which converts the XML to a flat file - in the format required by the customer. I don't use any orchestration, this is a pure message based solution.
This all works great when sending via FTP. However, the 3rd party have now requested that I push the message to a web service they hosy. I haven't received the WSDL yet but can assume that the method I'll be calling simply receives a string as a single parameter.
Could anyone advise on the best way to approach this please? I have created a simple web service stub. I then followed Recipe 6-11 from the excellent BizTalk 2006 Recipes book, generating a proxy class using wsdl.exe which I then reference from the "web service" tab of the SOAP send port. However, when processing an order I get the following message in the event log:
Could not load type 'WSProxy' from assembly 'Direct.IS.Payment.Components, Version=3.1.145.0, Culture=neutral, PublicKeyToken=dc03da781bea1472'.".
The type must derive from System.Web.Services.Protocols.SoapHttpClientProtocol.
The type must have the attribute System.Web.Services.WebServiceBindingAttribute. ".
Next step will be for me to play around with the proxy so that it address the derive and attribute issues mentioned in the even log message. However, I can't help but think that there must be an easier way?
Thanks

The custom pipeline component you have created is not producing a message that is suitable for SOAP transmission. Not knowing what the end customer is going to do, I'd hold off on trying ot make SOAP work. In the mean time, just spin up an ASPX page with the following code:
private void Page_Load(object sender, EventArgs e)
{
StreamReader reader = new StreamReader(page.Request.InputStream);
String xmlData = reader.ReadToEnd();
}
Add code to write XMLData to a DB or to a text file or something to see what it is. This is very crude and does not send a response code. It should get you started.

Related

catching Talend error in web Application

I have created a Talend job and deployed it as a Axis Web Service.
I am calling this Web Service from my Web Application.
My application and web service are deployed over Tomcat server.
For Valid Inputs:
Runs Perfectly.
For Invalid Inputs:
It throws Error/exceptions in Tomcat Server.
I want this Errors into my application. I didn't get any error related information in the Response sent by web service.
Error message on Tomcat Server
XML response of Web service
If I understand your question you are not so much asking how to fix this error, but how to get feedback about your error. There are several ways but here is a simple method.
Add a tLogCatcher to your job, and point its output to a tSendMail component. You can run the output thru a tMap do things like adding HTML formatting. You can also create a joblet with these two components and use the joblet in every job so you do not have to recreate it every time.
The diagram below shows a real simple case where I add tLogCatcher and tSendMail directly to the job. When there is an error it will send me an email with the details. You can use any of the columns in row11, I am only using job and message in my example.
This error : For input string "fabrik"
is generated by the tFileInputExcel component when encountering a non valid field (expected : integer ; given : string). You can't directly catch this error with the tFileInputExcel component (it's just printed out on the console).
However, you can use a tSchemaComplianceCheck component after your tFileInputExcelComponent : it will throw an error if a data is not valid for your schema. This component has a reject link to catch the error.
tFileInputExcel->tSchemaComplianceCheck->tMap->tMSOutput
If you use tLogCatcher component to catch the error then, at the end of the flow, you can add a tBufferOutput component. Keep the fields with the information you want for.
component configuration
The result will be like this (note that they are shown in the same order):
result

Spring WS endpoint routing when whole body is encrypted

So I'm working with Spring Boot to implement a service API for interop with a third party. I'm using payload-based routing because they are not sending SOAPAction or any addressing information. However, when a request comes in, it's trying to map one of the incoming encryption-related elements and failing to map. I think the problem is that my friends at the third party are element-encrypting the operation element:
<n1:body>
<n2:SomeOperation> // This is
...some content... // all
</n3:SomeOperation> // encrypted
</n1:body>
From my reading, Spring attempts to map to an endpoint before encryption, so payload mapping will never work. I could use #Action or #SoapAction, but they are using Soap 1.2 (so no action header) and not using addressing. I have also verified that the Wss4SecurityInterceptor is being added, but is never called when a request is made.
Is my assessment/understanding of the situation correct? Can anyone think of any workarounds, because having the remote party change anything is nearly impossible.
A related question (hopefully asking one is not too unorthodox): I was trying to make my test client only encrypt the content of my operation element, but my setSecurementEncryptionParts() call is not playing nice. Here's the outgoing payload(from the console):
<ns2:EchoTestInput xmlns:ns2="http://xml.netbeans.org/schema/EchoTestSchema">
<ns2:valueIn>Quack</ns2:valueIn>
</ns2:EchoTestInput>
And here's the call to setSecurementEncryptionParts()
securityInterceptor.setSecurementEncryptionParts("{Content}{http://xml.netbeans.org/schema/EchoTestSchema}EchoTestInput");
I thought this should all be easy, but I guess not. Thanks a million in advance!

Enterprise service object from WSDL returns null

I created a service consumer through the wizard, based on a WSDL. Proxy object is generated, all structures and methods are found. Then, I add a logical port through SOAMANAGER - all fine, it pings and the connection works.
I populate the input structure, call my method and get an error: Error during proxy processing (PART UNKNOWN (NULL)). This is a very useless error message to me.
So, I activate all manners of tracing, so I can see what's going on calling and retrieving data. I can see that
My proxy is called correctly
The payload sent TO the service looks correct
The payload received FROM the service is correct. I know this because it's identical to the XML I get back calling the service through other means.
The transformation is empty
Here a screen of (the start of) the returned XML. getRecordsResult set is what I need:
This is the second response, after "conversion":
Nothing about this service has been customized: it's generated straight up through the wizard. I have already deleted and recreated it but no results.
Anyone got any advice on what to do next?

Truncated Java object when passing through JAX-WS WebService

I am currently working on a project that uses JAX-WS webservices in Java.
The global topic is this : the user creates locally an object, let's say an Agent. He calls a first webservice and passes its Agent to the webservice. The webservice treats the Agent (modifies its properties : e.g. lifepoints), and passes it to another webservice. This call is made from the first webservice, so the user has nothing to do in the process.
After a chain of several webservices, the user retrieves the Agent that has been modified.
The aim of my project is to design 2 parts:
a framework that specifies the behaviour previously described : webservices, Agents and the process of migration
a demo application using my framework. The main difference is the addition of a GUI and a new class Avatar, that extends Agent. So the migration process is still being done "by the framework", with Agent objects.
The following code shows a simple example of how I call my webservice, host my Avatar, then retrieves the agent from the service :
// connection to the server
URL endpoint= new URL("http://SERVER/tomcat/KiwiBidonDynamique/ServiceWebBidonDeDadou?wsdl");
QName serviceName=new QName("http://avatar/","ServeurKiwiBidonService");
Service service = Service.create(endpoint, serviceName);
WebService port = service.getPort(WebService.class);
Avatar myAvatar = new Avatar(1, "Jack the Ripper");
port.hostAgent(myAvatar);
// some process on the service...
Avatar myAvatarTransformed = (Avatar) port.getAgent("AgentNumberOne");
When I do that, I get an exception on the final line :
Exception in thread "main" java.lang.ClassCastException: agent.Agent cannot be cast to avatar.Avatar
After a lot of log reading, I guess the reason is the way the webservice works. When being called, my Avatar given in parameter is marshalled in my JVM then unmarshalled on the service, but the service only constructs an Agent when it unmarshalles. Doing so, it truncates the data specific to the Avatar. Then when I try to retrieve my Agent from the service, it cannot be cast to an Avatar.
Is there a way to keep the Avatar information while processing as an Agent on the service ?
Can I write my own marshalling/unmarshalling somehow ?
Thanks a lot.
If your webservice has Agent element defined as incoming data, then no it is not possible to unmarshall it into an inherited class. I guess it would be possible to write your own marshaller but it is not as easy as it sounds (I would advise against it). Either write a separate WS for each class (messy) or make the incoming data have an element that can store additional structures, like type:any (also messy). The truth is WS are not exactly OO.

BizTalk 2006 R2 EDI

I have an working orchestration in place to process X12 messages. Now I need to expose the orchestration as a webservice (ASMX) that accepts a text input (the X12 message) and returns the text response (the X12 response). If I try to use the wizard, the generated webservice will expose the inner XML representation of the X12 request and not the its original plain text representation.
In short, I want to be able to connect to a webservice (ASMX and not a WCF service), send a X12 request (plain text) and get the appropriate response (also plain text).
I've seen examples of this using WCF, but none with a simple webservice.
Can you give me a hand with this?
Thanks!
One possible solution would be to create a SOAP handler to convert the plain text to the xml representation (so BizTalk can read it) and back again. While I haven't tried this myself, it might work. You would need to create a handler for the request and one for the response to intercept the string and convert it to the xml schema and back again. You can also look at using a generic XML document instead of a string, that might be easiest. Check out this post:
http://blogs.msdn.com/richardbpi/archive/2006/11/10/exposing-biztalk-web-services-that-accept-generic-content.aspx
-Bryan
While I haven't tried, I have a feeling you will not be able to do that without some degree of custom coding in the pipeline.
When you publish the web service using the wizard, BizTalk takes the schemas involved and uses them as the types for the web service, this makes sense in almost all cases, but not in yours.
However , as far as I know, there is no good way to take and EDI message over SOAP; you could create your web service to accept a string message and have the client "know" that it needs to be X12, but there's no way to describe that in the WSDL.
If you would do that, however, you will get the X12 message into the pipeline, wrapped in a element (or somehting like that, depending on how you've modified your web service), before you get to the disassembler and to the orchestration you will have to have some code to strip that out, but that should be relatively easy to write.
I would also Translate my x12 260 file to SOAP Webservice . what are the best way... iam converting to XML & sending to SOAP... but here a problem is i get only 3 xml's which has only Transaction Details inside that file.... where are my Header & Trailers gone :(
Anyone faced such issue