Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
vtabel
Contributor
Contributor

problem in code tWebServiceInput

hello everyone,

i  have  trouble    with the java code in twebserviceinput. in advanced option i created the routines with the wsdl2java without the problem. 

follows below the code i made:

 
routines.IServiceIntegration iservicesoap = new routines.ServiceIntegrationLocato().getBasicHttpBinding_IServiceIntegratio();

routines.BasicHttpBinding_IServiceIntegrationStub stub=(routines.BasicHttpBinding_IServiceIntegrationStub)iservicesoap;

 

routines.InsertFileType filetype =new InsertFileType ();

 

 

 

String xml= "<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?><DocumentElement><ComponenteIndicatore><Anno>2018</Anno><Mese>03</Mese><Sede>010000</Sede><Sistema>LINEAINPS</Sistema><CodInd>0001</CodInd><TipoComp>D</TipoComp><Categoria>DefTot</Categoria><SubCat>N.A.</SubCat><Criterio>N.A.</Criterio><Quantita>2316</Quantita><Coefficiente>1</Coefficiente></ComponenteIndicatore><ComponenteIndicatore><Anno>2018</Anno><Mese>03</Mese><Sede>010000</Sede><Sistema>LINEAINPS</Sistema><CodInd>0001</CodInd><TipoComp>N</TipoComp><Categoria>Def5gg</Categoria><SubCat>N.A.</SubCat><Criterio>N.A.</Criterio><Quantita>1681</Quantita><Coefficiente>1</Coefficiente></ComponenteIndicatore></DocumentElement>" ;

 

 

 byte[] fileBuffer = org.apache.commons.codec.binary.Base64.encodeBase64Chunked(xml.getBytes());

byte[] fileBuffer1 =fileBuffer;

 

 Integer filesize= fileBuffer.length;

 filetype.setAnno(2018);

filetype.setMese(3);

filetype.setArea("3");

 filetype.setFileBuffer(fileBuffer1);

filetype.setFileName("myfile");

 filetype.setFilePosition(0L);

filetype.setFoglio("DEFAULT");

filetype.setNote("DEFAULT");

filetype.setUserName("LINEAINPS" );

filetype.setPassWord("LINEAINPS01");

filetype.setTemplateID("20180323_Template_componente_indicatore");

filetype.setUfficio("DEFAULT");

 Boolean bEsitoWS = Boolean.FALSE;

 System.out.println("il file è grande :"+" "+filesize+" "+"byte");

 if (filesize <=2000000) { 

/*String fileBuffer =routines.EncodeDecodeExample.encodeString(xml,"ASCII");*/

 bEsitoWS = iservicesoap.uploadFileXML(filetype, routines.TipologiaCaricamento.NonCancellareNiente);

} else {

bEsitoWS = iservicesoap.uploadFileXMLPacket(filetype, routines.TipologiaCaricamento.NonCancellareNiente);

}

if(bEsitoWS) {

 row1.getAnno=filetype.getAnno();

row1.getMese=filetype.getMese();

row1.getArea=filetype.getArea();

row1.getFileBuffer= filetype.getFileBuffer();

row1.getFileName=filetype.getFileName();

row1.getFilePosition=filetype.getFilePosition();

row1.getFoglio=filetype.getFoglio();

row1.getNote=filetype.getNote();

row1.getUserName=filetype.getUserName();

row1.getPassWord=filetype.getPassWord();

row1.getTemplateID=filetype.getTemplateID();

row1.getUfficio=filetype.getUfficio();

} else {

throw new Exception(row1.Erroreinvio="Errore invio");

 }

 

in the filebuffer parameter when I do encodeBase64 it fails me with the following error:

Exception in component tWebServiceInput_1

AxisFault

faultCode: {http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher}InternalServiceFa...

faultSubcode:

faultString: Data at the root level is invalid. Line 1, position 1.

faultActor:

faultNode:

faultDetail:

{http://schemas.datacontract.org/2004/07/System.ServiceModel}ExceptionDetail:<HelpLink i:nil="true"/><InnerException i:nil="true"/><Message>Data at the root level is invalid. Line 1, position 1.</Message><StackTrace> at wsCdGIntegration.ServiceIntegration.UploadFileXML(InsertFileType composite, TipologiaCaricamento Caricamento) in c:\Build\Intranet\NET2012\CG043_S1_WSCdGIntegration\WSCdGIntegration\ServiceIntegration.svc.cs:line 234

at SyncInvokeUploadFileXML(Object , Object[] , Object[] )

at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs)

at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)

at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)

[statistics] disconnected

at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc&amp; rpc)

at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><Type>System.Xml.XmlException</Type>

 

Data at the root level is invalid. Line 1, position 1.

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)

etc....

 

 when I just cast in bytes without encodeBase64 the job is working fine.

someone can help me understand.

Labels (1)
0 Replies