This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

SOAP  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is My java Program.By Using this iam trying to invoking a webservice in
weblogic



import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPFactory;
import javax.xml.soap.SOAPPart;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPBodyElement;
import java.io.FileOutputStream;
import java.io.File;
import javax.xml.soap.SOAPFault;
import javax.xml.soap.SOAPException;
import java.io.IOException;
public class SOAPSender {

public static void main(String args[]){

try{
System.setProperty("javax.xml.soap.MessageFactory",
"weblogic.webservice.core.soap.MessageFactoryImpl");

System.setProperty("javax.xml.soap.ConnectionFactory",
"weblogic.webservice.core.soap.SOAPConnectionFactoryImpl");

MessageFactory msg_factory=MessageFactory.newInstance();
SOAPFactory soap_factory=SOAPFactory.newInstance();
SOAPMessage msg_soap=msg_factory.createMessage();
SOAPMessage msg_ressoap;
SOAPConnectionFactory con_factory=SOAPConnectionFactory.newInstance();
SOAPConnection con_soap=con_factory.createConnection();
SOAPPart part_soap=msg_soap.getSOAPPart();
SOAPEnvelope envelope_soap=part_soap.getEnvelope();
//SOAPHeader header_soap=envelope_soap.addHeader();
SOAPBody body_soap=envelope_soap.getBody();
Name name_soap=soap_factory.createName("add","a","http://First.com/plainWebservice");
SOAPBodyElement body_element=body_soap.addBodyElement(name_soap);
body_element.addAttribute(name_soap,"xmlns:m=http://First.com/plainWebservice");
Name name_childsoap1=soap_factory.createName("intVal");
SOAPElement element_soap=body_element.addChildElement(name_childsoap1);
element_soap.addTextNode("100");
Name name_childsoap2=soap_factory.createName("intVal0");
SOAPElement element_soap1=body_element.addChildElement(name_childsoap2);
element_soap1.addTextNode("100");
System.out.println("Request");
System.out.println("------------------------------------");
msg_soap.writeTo(System.out);
msg_ressoap=con_soap.call(msg_soap,"http://localhost:7001/webservice1/plainWebservice");
SOAPFault fault=msg_ressoap.getSOAPPart().getEnvelope().getBody().addFault();
System.out.println("Fault Actor"+fault.getFaultString());
File f=new File("d:/webservices/First.xml");
FileOutputStream fos=new FileOutputStream(f);
System.out.println("------------------------------------");
System.out.println("Response");
System.out.println("------------------------------------");
msg_ressoap.writeTo(System.out);
System.out.println("------------------------------------");
}catch(SOAPException e){e.printStackTrace();}
catch(IOException io){io.printStackTrace();}
}
}


The response Fault Message is Like This




<env:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xs
i="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.
org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><env:Header/><e
nv:Body><env:Fault><faultcode>Client</faultcode><faultstring>Internal Error: una
ble to process your request: javax.xml.soap.SOAPException: Faild to build xml no
de: Error at Line:1, token:[OPENTAGBEGIN]Undefined Symbol:a</faultstring></env:F
ault><env:Fault/></env:Body></env:Envelope>------------------------------------
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you tell me why you are trying to add fault to the received SOAP Response message,in below call?
SOAPFault fault=msg_ressoap.getSOAPPart().getEnvelope().getBody().addFault();

- Satya
 
He was expelled for perverse baking experiments. This tiny ad is a model student:
ScroogeXHTML 8.2 - easy to use RTF to HTML converter library
https://coderanch.com/t/707504/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!