You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by suraneni <su...@yahoo.com> on 2008/04/14 09:53:28 UTC
Re: Axis 1.4 web service client with NTLM authentication, getting
"premature end of file" exception
Hi All,
Please respond if you have a solution for this problem. I a struggling a lot
with it.
Thanks,
sreekanth
suraneni wrote:
>
> Hi All,
>
> I have written an axis 1.4 client for a web service and it was working
> properly, returning a response earlier.
> Recently the web service url is protected with windows authentication. A
> pop up is appearing for windows domain, username and password if I type
> the url in internet explorer.
>
> I have updated the client to have NTLM authentication. I have modified the
> client-config.wsdd file in "org.apache.axis.client" package for this to
> use "CommonsHttpSender" instead of "HttpSender" and in the client I am
> setting the "domain\\username" and "password" for call object. The web
> service itself have an authentication for which I am including the header
> part containing the authentication information.
>
> The java code for client is as follows:
>
> String Username = "XXX";
> String Pswd = "XXXXX";
> String Authentication = "ARSystem";
> String Locale = "en_US";
> String timeZone = "GMT";
> Service service = new Service();
>
> Call call = (Call)service.createCall();
> URL url = new
> URL("http://nxprd01/arsys/services/ARService?server=devrmd04.unix.gsm1900.org&webService=UserCARE");
> call.setUsername("domain\\username");
> call.setPassword("Password");
> call.setTargetEndpointAddress(url);
>
> try {
> SOAPHeaderElement Helement = new
> SOAPHeaderElement("http://www.w3.org/2001/XMLSchema","AuthenticationInfo");
> SOAPElement element;
> element = Helement.addChildElement("userName");
> element.addTextNode(Username);
> element = Helement.addChildElement("password");
> element.addTextNode(Pswd);
> element = Helement.addChildElement("authentication");
> element.addTextNode(Authentication);
> element = Helement.addChildElement("locale");
> element.addTextNode(Locale);
> element = Helement.addChildElement("timeZone");
> element.addTextNode(timeZone);
>
> call.addHeader(Helement);
>
> }
> catch(Exception e)
> {
> System.out.println("Exception during authentication....." +
> e.getMessage());
> }
> //call.setEncodingStyle("UTF-8");
> call.setOperationName(new
> javax.xml.namespace.QName("urn:UserCARE", "OpCreate"));
>
> String acct_Creator = null;
> String application_License = null;
> String computed_Grp_List ="8051;";
> String creator = "ssurane1";
> String default_Notify_Mechanism = Default_Notify_MechanismType._Email;
> String department ="EIT";
> String email_Address= "sree@test.com";
> String employeeID= "P1234455";
>
> String first_Name ="Sreekanth";
> String flashboard_License_Type = Flashboard_License_TypeType._None;
> String full_Name = "Sreekanth Suraneni";
> String full_Text_License_Type = Full_Text_License_TypeType._None;
> String group_List = "8051;";
> String last_Name = "Suraneni";
>
> String license_Type = License_TypeType._value2;
> String login_Name = "ssurane1";
> String manager = "Manager Me";
> String office = "Tampa Data Center";
> String office_Phone = "615-718-7129";
> String password = "xxxxx";
> String PCS_Phone = "615-718-7129";
> String primary_Group = "8051";
> String samson_ID = "sam001";
> String status = StatusType._Active;
> String TCS_Name = "xxxxx";
> String title = "xxxxxx";
> String training_ID = "11233";
>
>
> System.out.println("Before Invoke......................");
>
> // For OpCreate
>
> call.addParameter("Acct_Creator", XMLType.XSD_STRING, ParameterMode.IN);
> call.addParameter("Application_License", XMLType.XSD_STRING,
> ParameterMode.IN); //
> call.addParameter("Computed_Grp_List", XMLType.XSD_STRING,
> ParameterMode.IN);
> call.addParameter("Creator", XMLType.XSD_STRING, ParameterMode.IN);
> call.addParameter("Default_Notify_Mechanism", XMLType.XSD_STRING,
> ParameterMode.IN);
> call.addParameter("Department", XMLType.XSD_STRING, ParameterMode.IN);
> call.addParameter("Email_Address", XMLType.XSD_STRING,
> ParameterMode.IN);
>
> call.addParameter("employeeID", XMLType.XSD_STRING, ParameterMode.IN);
> //
> call.addParameter("First_Name", XMLType.XSD_STRING, ParameterMode.IN);
> call.addParameter("Flashboard_License_Type", XMLType.XSD_STRING,
> ParameterMode.IN);
> call.addParameter("Full_Name", XMLType.XSD_STRING, ParameterMode.IN); //
> call.addParameter("Full_Text_License_Type", XMLType.XSD_STRING,
> ParameterMode.IN);
> call.addParameter("Group_List", XMLType.XSD_STRING, ParameterMode.IN);
>
> call.addParameter("Last_Name", XMLType.XSD_STRING, ParameterMode.IN);
> call.addParameter("License_Type", XMLType.XSD_STRING, ParameterMode.IN);
> call.addParameter("Login_Name", XMLType.XSD_STRING, ParameterMode.IN);
> call.addParameter("Manager", XMLType.XSD_STRING, ParameterMode.IN);
> call.addParameter("Office", XMLType.XSD_STRING, ParameterMode.IN);
> call.addParameter("Office_Phone", XMLType.XSD_STRING, ParameterMode.IN);
> //
> call.addParameter("Password", XMLType.XSD_STRING, ParameterMode.IN);
> call.addParameter("PCS_Phone", XMLType.XSD_STRING, ParameterMode.IN);
> call.addParameter("Primary_Group", XMLType.XSD_STRING,
> ParameterMode.IN);
> call.addParameter("Samson_ID", XMLType.XSD_STRING, ParameterMode.IN);
>
> call.addParameter("Status", XMLType.XSD_STRING, ParameterMode.IN);
> call.addParameter("TCS_Name", XMLType.XSD_STRING, ParameterMode.IN);
> call.addParameter("Title", XMLType.XSD_STRING, ParameterMode.IN);
> call.addParameter("Training_ID", XMLType.XSD_STRING, ParameterMode.IN);
> call.setReturnType(XMLType.XSD_STRING);
>
> System.out.println("Before invoke*****");
>
> Object _resp = call.invoke(new Object[] { acct_Creator,
> application_License, computed_Grp_List, creator,
> default_Notify_Mechanism, department, email_Address, employeeID,
> first_Name, flashboard_License_Type,
> full_Name,full_Text_License_Type,
> group_List, last_Name, license_Type, login_Name, manager,
> office, office_Phone,
> password, PCS_Phone, primary_Group, samson_ID, status, TCS_Name,
> title,
> training_ID
> });
>
>
> System.out.println(_resp);
>
>
> I am getting a premature end of file exception in the output as follows.
>
> - Unable to find required classes (javax.activation.DataHandler and
> javax.mail.internet.MimeMultipart). Attachment support is disabled.
> Before Invoke......................
> Before invoke*****
> - ntlm authentication scheme selected
> AxisFault
> faultCode:
> {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> faultSubcode:
> faultString: org.xml.sax.SAXParseException: Premature end of file.
> faultActor:
> faultNode:
> faultDetail:
> {http://xml.apache.org/axis/}hostname:NXPRDWSRIT01
>
> org.xml.sax.SAXParseException: Premature end of file.
> at
> org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
> at
> org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
> at
> org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
> at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source)
> at org.apache.crimson.parser.Parser2.content(Unknown Source)
> at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source)
> at org.apache.crimson.parser.Parser2.content(Unknown Source)
> at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source)
> at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source)
> at org.apache.crimson.parser.Parser2.parse(Unknown Source)
> at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source)
> at javax.xml.parsers.SAXParser.parse(Unknown Source)
> at
> org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
> at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
> at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
> at
> org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
> at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
> at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
> at org.apache.axis.client.Call.invoke(Call.java:2767)
> at org.apache.axis.client.Call.invoke(Call.java:2443)
> at org.apache.axis.client.Call.invoke(Call.java:2366)
> at org.apache.axis.client.Call.invoke(Call.java:1812)
> at UserCARE.client.NewTestClient.main(NewTestClient.java:169)
>
> I have recorded the SOAP request using the TCPMON tool and here is the
> soap request which is going to the server (pasting the request exactly as
> it appears in tcpmon tool):
>
> POST
> /arsys/services/ARService?server=devrmd04.unix.gsm1900.org&webService=UserCARE
> HTTP/1.1
> Content-Type: text/xml; charset=utf-8
> SOAPAction: ""
> User-Agent: Axis/1.4
> Host: 127.0.0.1:9876
> Transfer-Encoding: chunked
>
>
> 8d8
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <soapenv:Header>
> <xsd:AuthenticationInfo
> soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
> soapenv:mustUnderstand="0">
> <xsd:userName>XXX</xsd:userName>
> <xsd:password>XXXXXX</xsd:password>
> <xsd:authentication>ARSystem</xsd:authentication>
> <xsd:locale>en_US</xsd:locale>
> <xsd:timeZone>GMT</xsd:timeZone>
> </xsd:AuthenticationInfo>
> </soapenv:Header>
> <soapenv:Body>
> <ns1:OpCreate
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:ns1="urn:UserCARE">
> <Acct_Creator xsi:type="xsd:string" xsi:nil="true"/>
> <Application_License xsi:type="xsd:string" xsi:nil="true"/>
> <Computed_Grp_List
> xsi:type="xsd:string">8051;</Computed_Grp_List>
> <Creator xsi:type="xsd:string">ssurane1</Creator>
> <Default_Notify_Mechanism
> xsi:type="xsd:string">Email</Default_Notify_Mechanism>
> <Department xsi:type="xsd:string">EIT</Department>
> <Email_Address
> xsi:type="xsd:string">sree@test.com</Email_Address>
> <employeeID xsi:type="xsd:string">P1234455</employeeID>
> <First_Name xsi:type="xsd:string">Sreekanth</First_Name>
> <Flashboard_License_Type
> xsi:type="xsd:string">None</Flashboard_License_Type>
> <Full_Name xsi:type="xsd:string">Sreekanth
> Suraneni</Full_Name>
> <Full_Text_License_Type
> xsi:type="xsd:string">None</Full_Text_License_Type>
> <Group_List xsi:type="xsd:string">8051;</Group_List>
> <Last_Name xsi:type="xsd:string">Suraneni</Last_Name>
> <License_Type xsi:type="xsd:string">Fixed</License_Type>
> <Login_Name xsi:type="xsd:string">ssurane1</Login_Name>
> <Manager xsi:type="xsd:string">Manager Me</Manager>
> <Office xsi:type="xsd:string">Tampa Data Center</Office>
> <Office_Phone
> xsi:type="xsd:string">615-718-7129</Office_Phone>
> <Password xsi:type="xsd:string">xxxxx</Password>
> <PCS_Phone xsi:type="xsd:string">615-718-7129</PCS_Phone>
> <Primary_Group xsi:type="xsd:string">8051</Primary_Group>
> <Samson_ID xsi:type="xsd:string">sam001</Samson_ID>
> <Status xsi:type="xsd:string">Active</Status>
> <TCS_Name xsi:type="xsd:string">xxxxx</TCS_Name>
> <Title xsi:type="xsd:string">xxxxxx</Title>
> <Training_ID xsi:type="xsd:string">11233</Training_ID>
> </ns1:OpCreate>
> </soapenv:Body>
> </soapenv:Envelope>0
>
>
> I request you to please help me in resolving this issue.
>
> Thanks,
> Suraneni
>
>
>
>
>
--
View this message in context: http://www.nabble.com/Axis-1.4-web-service-client-with-NTLM-authentication%2C-getting-%22premature-end-of-file%22-exception-tp16270117p16672761.html
Sent from the Axis - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org