Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Marcio Veloso

Problemas na execução de WebService

Recommended Posts

Opa galerinha, blza?

 

Meu problema é bastante complicado, não sei se conseguirão ajudar mas ai vai.

Tenho uma aplicação, que em determinado momento chamo um webservice para realizar algumas consultas e me retorna alguns dados do usuário.

 

O problema é que se fico uns 2 minutos sem utilizar o webservice, ao utilizá-lo, demora certa de 21s para retornar os dados, mas só na primeira vez, já na segunda, terceira o tempo tende a diminuir cada vez mais.

 

Abaixo o código da página ASP que chama e recebe os dados do webservice ...

 



<%	
On Error Resume Next 

'-- Query Customer Party		
Dim objXmlHttp, strPOST, strRESPONSE, vCODE
Dim vANI, vIP_POST

'/ Criacao do Objeto XML para o POST
Set objXmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
objXmlHttp.setOption(2) = SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS

'/ Set Timeouts
lResolve = 30 * 1000
lConnect = 30 * 1000
lSend = 30 * 1000
lReceive = 30	* 1000
objXmlHttp.setTimeouts lResolve, lConnect, lSend, lReceive


'/APONTAMENTOS - release Julho de 2011
vIP_POST="https://XPTO" 'Producao

'Variaveis de entrada é o ID do cliente
p_numero = "XPTO"


       'Preparando a String que será enviada na consulta
strPOST = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:quer= 'http://xmlns.oracle.com/ABCSImpl/URA/QueryCustomerPartyURAReqABCSImpl'>"
strPOST = strPOST & "   <soapenv:Header/>"
strPOST = strPOST & "   <soapenv:Body>"
strPOST = strPOST & "      <quer:QueryCustomerPartyReqMsg>"
strPOST = strPOST & "         <quer:QueryCustomerParty>"
strPOST = strPOST & "            <quer:Identification>" & p_numero & "</quer:Identification>"
strPOST = strPOST & "         </quer:QueryCustomerParty>"
strPOST = strPOST & "      </quer:QueryCustomerPartyReqMsg>"
strPOST = strPOST & "   </soapenv:Body>"
strPOST = strPOST & "</soapenv:Envelope>"

'/ Instanciando conexão e enviando objeto
objXmlHttp.Open "POST", vIP_POST , False
objXmlHttp.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
Response.write "<BR>Inicio:" & Time()
objXmlHttp.Send(strPOST)
strRESPONSE = objXmlHttp.responseText
Response.write "<BR>Fim:" & Time()

response.write "<BR>Requisicao: " & strPOST & "<BR><BR>" 

Set objXmlHttp = Nothing

       'Recuperando os dados do objeto
Dim xmlDoc
Set xmlDoc = Server.CreateObject("Msxml2.DOMDocument.4.0")
xmlDoc.async= False
xmlDoc.setProperty "SelectionLanguage", "XPath"
xmlDoc.resolveExternals = False
xmlDoc.loadXML(strRESPONSE)


response.write "<BR>Retorno: " & strRESPONSE & "<BR><BR>"

xmlDoc.setProperty "SelectionNamespaces","xmlns='http://xmlns.oracle.com/ABCSImpl/URA/QueryCustomerPartyURAReqABCSImpl' xmlns:env='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ns0='http://xmlns.oracle.com/ABCSImpl/URA/QueryCustomerPartyURAReqABCSImpl'"

If xmlDoc.parseError.errorCode <> 0 and len(strRESPONSE)=0 Then
	response.Write "-------------------- ERRO ------------------ " & "<BR>"
	Response.Write "Código do erro: "& xmlDoc.parseError.ErrorCode &"<br />"
	Response.Write "Posição no arquivo: "& xmlDoc.parseError.FilePos &"<br />"
	Response.Write "Linha: "& xmlDoc.parseError.Line &"<br />"
	Response.Write "Posição na linha: "& xmlDoc.parseError.LinePos &"<br />"
	Response.Write "Descrição: "& xmlDoc.parseError.Reason &"<br />"
	Response.Write "Texto que causa o erro: "& xmlDoc.parseError.srcText &"<br />"
	Response.Write "Arquivo com problemas: " & xmlDoc.parseError.URL
Else
	dim erro, v_MemberNumber, v_Name, v_LoginName, v_CPF, v_ContactId, v_Email, v_PontosVencer90Dias, v_Status, v_AvailablePoints, v_StreetName, v_Number, v_Complements, v_Neighbourhood, v_Municipality, v_State, v_PostalCode, v_Country, v_SiebelRowId

	' Get Items
	erro = xmlDoc.documentElement.selectNodes("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ErrorCode/").text
	erroMsg = xmlDoc.documentElement.selectNodes("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ErrorMessage/").text

	''If (N = 0)Then 'Verificando se nao recebeu erro no XML
	if (erro<>0) then
			'Check for Error
			response.Write "-------------------- RETORNO ------------------ " & "<BR>"
			Response.Write "Código do erro: "& erro &"<br />"
			Response.Write "Mensagem: "& erroMsg &"<br />"
	Else
			v_MemberNumber = xmlDoc.selectSingleNode("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ns0:QueryCustomerPartyResponse/ns0:MemberNumber").text
			v_Name = xmlDoc.selectSingleNode("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ns0:QueryCustomerPartyResponse/ns0:Name").text
			v_LoginName = xmlDoc.selectSingleNode("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ns0:QueryCustomerPartyResponse/ns0:LoginName").text
			v_CPF = xmlDoc.selectSingleNode("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ns0:QueryCustomerPartyResponse/ns0:CPF").text
			v_ContactId = xmlDoc.selectSingleNode("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ns0:QueryCustomerPartyResponse/ns0:ContactId").text
			v_Email = xmlDoc.selectSingleNode("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ns0:QueryCustomerPartyResponse/ns0:Email").text
			v_PontosVencer90Dias = xmlDoc.selectSingleNode("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ns0:QueryCustomerPartyResponse/ns0:PontosVencer90Dias").text
			v_Status = xmlDoc.selectSingleNode("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ns0:QueryCustomerPartyResponse/ns0:Status").text
			v_AvailablePoints = xmlDoc.selectSingleNode("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ns0:QueryCustomerPartyResponse/ns0:AvailablePoints").text
			v_StreetName = xmlDoc.selectSingleNode("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ns0:QueryCustomerPartyResponse/ns0:StreetName").text
			v_Number = xmlDoc.selectSingleNode("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ns0:QueryCustomerPartyResponse/ns0:Number").text
			v_Complements = xmlDoc.selectSingleNode("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ns0:QueryCustomerPartyResponse/ns0:Complements").text
			v_Neighbourhood = xmlDoc.selectSingleNode("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ns0:QueryCustomerPartyResponse/ns0:Neighbourhood").text
			v_Municipality = xmlDoc.selectSingleNode("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ns0:QueryCustomerPartyResponse/ns0:Municipality").text
			v_State = xmlDoc.selectSingleNode("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ns0:QueryCustomerPartyResponse/ns0:State").text
			v_PostalCode = xmlDoc.selectSingleNode("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ns0:QueryCustomerPartyResponse/ns0:PostalCode").text
			v_Country = xmlDoc.selectSingleNode("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ns0:QueryCustomerPartyResponse/ns0:Country").text
			v_SiebelRowId = xmlDoc.selectSingleNode("/env:Envelope/env:Body/ns0:QueryCustomerPartyRespMsg/ns0:QueryCustomerPartyResponse/ns0:SiebelRowId").text

			'response.Write (strRESPONSE)
			response.Write "Member Number			= " & v_MemberNumber & "<BR>" 
			response.Write "Name					= " & v_Name & "<BR>"
			response.Write "Login Name				= " & v_LoginName & "<BR>" 
			response.Write "CPF						= " & v_CPF & "<BR>" 
			response.Write "ContactId				= " & v_ContactId & "<BR>" 
			response.Write "Email					= " & v_Email & "<BR>" 
			response.Write "PontosVencer90Dias		= " & v_PontosVencer90Dias & "<BR>" 
			response.Write "Status					= " & v_Status & "<BR>" 
			response.Write "AvailablePoints			= " & v_AvailablePoints & "<BR>" 
			response.Write "Number					= " & v_Number & "<BR>" 
			response.Write "Complements				= " & v_Complements & "<BR>" 
			response.Write "Neighbourhood			= " & v_Neighbourhood & "<BR>" 
			response.Write "Municipality			= " & v_Municipality & "<BR>" 
			response.Write "State					= " & v_State & "<BR>" 
			response.Write "PostalCode				= " & v_PostalCode & "<BR>" 
			response.Write "Country					= " & v_Country & "<BR>" 
			response.Write "SiebelRowId				= " & v_SiebelRowId & "<BR>" 

			vCODE = 0

	End if
End if 

response.Write "<br>" 
response.Write date & "<br>" & time 

%>

 

O meu ambiente de produção:

 

- Windows Server 2003.

- IIS 6.0 (Servidor Web)

- Microsoft MXML 4.0

 

Já trocamos para Windows 2008, IIS 7.5, mas o problema persiste. A mesma biblioteca é utilizada em outro web service, que responde sempre que instantaneamente, portanto estou quase descartando a possibilidade dela ser o problema.

 

Alguém já enfrentou isso antes?

 

Grande Abraço!

Compartilhar este post


Link para o post
Compartilhar em outros sites

já isso acontecer , gerando uma instabilidade no servidor mas era configuração do mesmo, tente rever seu code na biblioteca que faz a execução dessa aplicação, verifique o cache do webservice se ele esta armazenando

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.