powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Java [игнор отключен] [закрыт для гостей] / Вызов веб-сервиса с помощью axis
4 сообщений из 4, страница 1 из 1
Вызов веб-сервиса с помощью axis
    #37902498
Worst_Admin
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Доброе времени суток.
Есть некий веб сервис. Описание (wsdl) такой:
Код: xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://pgw.glbpay.com/api/pay.asmx" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://pgw.glbpay.com/api/pay.asmx">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://someurl.com/api/pay.asmx">
<s:element name="Callsvr">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="argXml" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="argTeststatus" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="CallsvrResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CallsvrResult" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="CallsvrSoapIn">
<wsdl:part name="parameters" element="tns:Callsvr"/>
</wsdl:message>
<wsdl:message name="CallsvrSoapOut">
<wsdl:part name="parameters" element="tns:CallsvrResponse"/>
</wsdl:message>
<wsdl:portType name="paySoap">
<wsdl:operation name="Callsvr">
<wsdl:input message="tns:CallsvrSoapIn"/>
<wsdl:output message="tns:CallsvrSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="paySoap" type="tns:paySoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Callsvr">
<soap:operation soapAction="http://someurl.com/api/pay.asmx/Callsvr" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="paySoap12" type="tns:paySoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Callsvr">
<soap12:operation soapAction="http://someurl.com/api/pay.asmx/Callsvr" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="pay">
<wsdl:port name="paySoap" binding="tns:paySoap">
<soap:address location="http://someurl.net/api/pay.asmx"/>
</wsdl:port>
<wsdl:port name="paySoap12" binding="tns:paySoap12">
<soap12:address location="http://someurl.net/api/pay.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>



Клиент:

Код: java
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
package wsc;

import java.net.MalformedURLException;
import java.net.URL;

import java.rmi.RemoteException;

import javax.xml.namespace.QName;

import javax.xml.rpc.ParameterMode;
//import javax.xml.rpc.Call;

import org.apache.axis.Constants;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;

public class Client_03 {
    public Client_03() {
    }

    public static void main(String[] args) {
        try{callWs();}catch(Exception e){e.printStackTrace();}
    }
    
    private static void callWs()throws Exception{
       String argXml = "some_params";
       String endpoint = "http://someurl.net/api/pay.asmx";
       URL url = new URL(endpoint);
       Service service = new Service();
       Call call = (Call)service.createCall();
       call.setTargetEndpointAddress(url);
       call.setSOAPActionURI("http://someurl.com/Callsvr");
       call.setOperationName(new QName(endpoint,"Callsvr"));
       call.setPortName(new QName("paySoap12"));
       call.addParameter(new QName(endpoint,"argXml"), Constants.XSD_STRING, ParameterMode.IN);
       call.addParameter(new QName(endpoint,"argTeststatus"), Constants.XSD_STRING, ParameterMode.IN);       
       call.setReturnType(Constants.XSD_STRING);    
       String result = (String)call.invoke(new Object[]{argXml,1});
       System.out.println("Result: " + result);
       }
}



В логах:

Код: java
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
 faultSubcode: 
 faultString: System.Web.Services.Protocols.SoapException: ???????? &lt;Callsvr xmlns='http://someurl.net/api/pay.asmx'&gt;?
   ? System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
   ? System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
   ? System.Web.Services.Protocols.SoapServerProtocol.Initialize()
   ? System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean&amp; abortProcessing)
 faultActor: 
 faultNode: 
 faultDetail: 
	{http://xml.apache.org/axis/}stackTrace:System.Web.Services.Protocols.SoapException: ???????? &lt;Callsvr xmlns='http://pgw.grapay.net/api/pay.asmx'&gt;?
   ? System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
   ? System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
   ? System.Web.Services.Protocols.SoapServerProtocol.Initialize()
   ? System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean&amp; abortProcessing)
	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 oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1345)
	at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:362)
	at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:308)
	at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:213)
	at oracle.xml.jaxp.JXSAXParser.parse(JXSAXParser.java:292)
	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.transport.http.HTTPSender.readFromSocket(HTTPSender.java:796)
	at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
	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 wsc.Client_03.callWs(Client_03.java:107)
	at wsc.Client_03.main(Client_03.java:23)

	{http://xml.apache.org/axis/}hostname:ALI

System.Web.Services.Protocols.SoapException: ???????? <Callsvr xmlns='http://someurl.net/api/pay.asmx'>?
   ? System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
   ? System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
   ? System.Web.Services.Protocols.SoapServerProtocol.Initialize()
   ? System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
	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 oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1345)
	at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:362)
	at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:308)
	at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:213)
	at oracle.xml.jaxp.JXSAXParser.parse(JXSAXParser.java:292)
	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.transport.http.HTTPSender.readFromSocket(HTTPSender.java:796)
	at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
	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 wsc.Client_03.callWs(Client_03.java:107)
	at wsc.Client_03.main(Client_03.java:23)
Process exited with exit code 0.



Что я делая не так? Помогите пожалуйста.
...
Рейтинг: 0 / 0
Вызов веб-сервиса с помощью axis
    #37902543
Фотография Blazkowicz
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Worst_Admin<soap12:operation soapAction=" http://someurl.com/api/pay.asmx/Callsvr" style="document"/>
call.setSOAPActionURI(" http://someurl.com/Callsvr");

Правильный action не пробовали?

Worst_AdminЧто я делая не так?
Используете Axis.
...
Рейтинг: 0 / 0
Вызов веб-сервиса с помощью axis
    #37902713
Worst_Admin
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
BlazkowiczWorst_Admin<soap12:operation soapAction=" http://someurl.com/api/pay.asmx/Callsvr" style="document"/>
call.setSOAPActionURI(" http://someurl.com/Callsvr");

Правильный action не пробовали?

Worst_AdminЧто я делая не так?
Используете Axis.
Вопрос решен. Action был правильным.
Какие варианты кроме аксиса? Burlap? Hessian?...?
...
Рейтинг: 0 / 0
Вызов веб-сервиса с помощью axis
    #37902990
Фотография Blazkowicz
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Worst_AdminAction был правильным.
Да, с фига ли.

Worst_AdminКакие варианты кроме аксиса?
JAX-WS

Worst_AdminBurlap? Hessian?...?
Это вообще не из той оперы. Это другие протоколы. А у вас SOAP.
...
Рейтинг: 0 / 0
4 сообщений из 4, страница 1 из 1
Форумы / Java [игнор отключен] [закрыт для гостей] / Вызов веб-сервиса с помощью axis
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]